So here in my code:
#include <iostream>
using namespace std;
int main ()
{
int choice;
cout<<"Make a choice\n";
cin>>choice;
cin.ignore();
while ( choice != 5 ) {
cout<<"Make a different choice!\n";
cin>>choice;
cin.ignore();
}
cout<<"You weren't supposed to enter 5!";
}
This works fine for entering in numbers, but whever I enter a string (i.e. a), the program simply writes
"Make a different choice!\n"
and infinite number of times! How do I handle a possible string input for choice?