Hi everybody! i have written an exercise i found here on cplusplus.com. I compile it and everything goes well, but the if statement at line 20, doesnt work. Any suggestions?
// While( user == gullible ) exercise
#include <iostream>
usingnamespace std;
int guess_count;
int n;
int main()
{
cout<<"Enter any number other than 5."<<endl;
while (1) {
guess_count=0;
cout<<"Enter number: "<<endl;
++guess_count;
cin>>n;
if (n==5) {
cout<<"Hey! you weren't supposed to enter 5!"<<endl;
break;
}
if (guess_count >= 10) {
cout<<"Wow, you're more patient then I am, you win."<<endl;
break;
}
else cout<<"Enter number again"<<endl;
}
system ("PAUSE");
return (0);
}