Re: Syntax errors will be the death of me!

  • From: Alex Hall <mehgcap@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Sat, 10 Jul 2010 22:40:54 -0400

Well, cpp is not my language, but you have a semicolon after the first
case in the switch, and I do not think it should be there.

On 7/10/10, Jes <theeternalkid@xxxxxxxxx> wrote:
> 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
>
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap@xxxxxxxxx; http://www.facebook.com/mehgcap
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: