theopfor
In Runtime
- Messages
- 173
- Location
- Right behind you
My if statements are having problems. I keep examples of things when learning a new language.
I get this problem in the debugger: main.cpp|18|error: 'else' without a previous 'if'|
Please help.
Code:
int n=3;
if (n==3); //this is an if statement
cout<<"If statement inside"<<endl;
cout<<"dot dot dot"<<endl;
cout<<"We are inside an else if statement"<<endl;
else if (n>2); //PROBLEM LINE
cout<<"else if"<<endl;
else //PROBLEM LINE
cout<<"else"<<endl;
Please help.