Saturday, 17 August 2013

"illegal else without matching if " in C

"illegal else without matching if " in C

I am new to C++.
I tried compile this simple program, but every time I try to compie it I
get the following error message:
"error C2181: illegal else without matching if"
Here is my code
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int a;
cout << "enter a integer: " << endl;
cin >> a;
if(a >= 56 && 76 <= a){cout<< "you win" << endl;};
else{
cout << "you lose"<< endl;
}
return 0;
}
Could someone tell me where my mistake is?

No comments:

Post a Comment