Thread: Help with syntax error

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    14

    Help with syntax error

    I am trying to write a program using switch. I keep getting a syntax error at line 19.

    Code:
    cout << "Enter the letter grades." << endl;
    	     << "Enter the EOF character to end input." << endl;
    This is the error that I get: program testing\switchexample\switchexample.cpp(19) : error C2143: syntax error : missing ';' before '<<'

    I have tried numerous ways to correct this error to no avail. Looking at examples in my books it looks to me like it is correct. It may be that I have worked on this so long that I am making the same mistake everytime I try to correct the code.

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Code:
    cout << "Enter the letter grades." << endl;  // Lose this semicolon
    	     << "Enter the EOF character to end input." << endl;
    And do you really expect your end uses to know what "Enter the EOF character to end input" means?
    Last edited by SlyMaelstrom; 02-27-2006 at 09:39 AM.
    Sent from my iPadŽ

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    14
    No, I hadn't even thought about that. I have changed that line to this:
    Code:
    << "Enter <ctrl-z> to end input." << endl;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 05:27 AM