Jump to content

  • Log In with Google      Sign In   
  • Create Account


if loop error


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 stevelevesque   Members   -  Reputation: 122

Like
Likes
Like

Posted 11 August 2001 - 04:44 PM

When i put an IF loop in one of my programs it always comes up with an error. The error says "error C2181: illegal else without matching if." I dont understand this because i do have an if statement. char c; cin>>c; { if(c==''1'') return 0; else cout<<"Hello"<

Sponsor:

#2 Martee   Members   -  Reputation: 476

Like
Likes
Like

Posted 11 August 2001 - 04:58 PM

Try this ...
  
char c;
cin >> c;
if(c == ''1'')
return 0;
else
cout << "Hello";


~~~~~~~~~~
Martee

#3 SirKnight   Members   -  Reputation: 316

Like
Likes
Like

Posted 11 August 2001 - 05:27 PM

Also an IF is NOT a loop. Its a comparison statement. Its called an if statement. A loop is something like for, do while, and while.

-SirKnight




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS