So I have my code, and you have to write a number. But if you enter a character it just shuts down... How can I make it read characters too withour crashing? Nope that the user chooses the number so it can be anything from 1-12.
int i; // you will enter i
int f; // flag
do{
f = 1;
cout << "\nEnter the value: ";
if( !(cin >> q) )
{
cin.clear();
cin.ignore( 100, '\n' );
f = 0;
}
}
while( !f );