So, I need to find a way to create a way for the computer to ask for input, for this example lets make it 1 and 2. 1 for yes and 2 for no.
int yes;
int no;
cout << Do you like orange chicken?" << endl;
cout << endl << "1 - Yes" << endl;
cout << "2 - No\n- ";
So my question is, if the user enters K or a char value, how do i get it to ask again? I've been trying to do this inside a do while loop and through a switch statement. I tried in an IF ELSE statement but i couldn't get CIN to register. I know you have to clear CIN after the loop with...
cin.clear();
Then i can get it to ask it again if what the wrong input the user put in was an int value. When the user enters a Char value, every time it goes into a infinite loop...
So if you could be so kind as to post some code that shows me how to do it and explain it that would be great. Thanks =)