RE: Syntax errors will be the death of me!

  • From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 10 Jul 2010 22:39:24 -0400

You have this:

 

Case 1:;

 

It should be

 

Case 1:

 

 

You have

 

Cout <<"something";  endl;

 

Should be

 

Cout <<"something<<endl;

 

I didn't look any further but I think that might help.

 

Ken

 

From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jes
Sent: Saturday, July 10, 2010 10:21 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Syntax errors will be the death of me!

 

Hey guys,

Here's a code for an assignment which has to be turned in tomorrow. Every
time I try to compile it, Visual Studio keeps telling me I'm missing a ;
before <<

What's wrong?

Code follows:

//Ch6ConE06.cpp

//Displays a class rank based on a code 

//entered by the user

//Created/revised by <your name> on <current date>

 

#include <iostream>

 

using std::cout;

using std::cin;

using std::endl;

 

int main()

{               

                //declare variable

                int code = 0;

 

                //enter input

                cout << "Enter the code: ";

                cin >> code;

//enter switch statements

switch(code)

{

case 1:;

cout << "Freshman. " ; << endl;

break;

case 2:

                cout <<"Sophomore"; << endl;

break;

case 3:

cout << "Junior "; << endl;

break;

case 4:

cout << "Senior" ; << endl;

break;

case 5:

cout << "Error! "; << endl;

}

//endswitch

//display output

 

    return 0;

}   //end of main function

 

Jes

 

Other related posts: