How can i make it so that my input only allows either the char a or b.
Basically this is what i have now.
cout << "Enter either a or b: ";
char ab;
cin >> ab;
cout << ab;
But in the event someone enters something other than a or b how can i make it keep asking until they do?