char experiment = 'Q'
is what I got, however if I were to type in "AAA" or simply more letters than one then it
will bug out a bit for me.
Is there some kind of similar text to this but for char:
int mainval;
while(true){
cout<<"1. Start game";
cout<<"2. Rules";
cout<<"3. Quit game";
cin>>mainval;
if( cin.good() && mainval >=1 && mainval <=3 ) {
break;
}
cin.clear();
cin.ignore( INT_MAX, '\n' );
}
Basicly if you type 1 or 2 it will continue, but anything else it will then reset and ask again.
Any idea how to do a similar thing, but for char?
(I only intend to do a simply Y/N question, (If possible, make it work with lower caps aswell ex: y/n)
Thank you.