Ok, I tried fixing the code but something is wrong, it says
8 C:\Documents and Settings\Chris\My Documents\My game\cout.cpp statement cannot resolve address of overloaded function
Here's the code
Code:
#include <iostream>
using namespace std;
int main()
{
int x;
cout<<"Please select 1 or 0\n";
cin>> x;
cin.ignore;
if ( x == 0 ) {
cout<<"Hi, you were wrong, please choose again\n";
cin>> x;
cin.ignore;
if ( x == 1 ) {
cout<<"Yay, you got it right!\n";
cin.get();
}
else if ( x == 1 ) {
cout<<"Well done!\n";
cin.get();
}
else {
cout<<"I said 1 or 0, pick again!\n";
cin>> x;
cin.ignore;
if ( x == 1 ) {
cout<<"Yay!\n";
}
}
Thanks.
Edit: To try and rephrase my question is, If I put a cin>> x; and someone named x 6 but then later in the program I wondered if it was possible to change x to 5, how do I change x? Actually after reading that that's complete BS. I hope you understand it. Also I wondered that in a if file example:
Code:
if ( x == 1 ) {
cout<<"Yay, you got it right!\n";
cin.get();
}
Do I need the cin.get(); ?
thanks