Hey everyone I have this problem with the menu to a game I'm programming.... I want a loop that will not screw up when I put something other than a number in it.... heres the code I used.
do
{
int character;
cout<<"1. Paladin\n";
cout<<"2. Warrior\n";
cout<<"3. Rogue\n";
cout<<"4. Mage\n";
cin>>character;
}while((character!=1) || (character!=2) || (character!=3) || (character!=4))
Problem is when I input a letter or anything other than a number it goes into an infinate loop where it wont let me enter any data, it simple keeps looping the text! How can I make it when I put in something other than a number that it simple goes through the menu agian and allows me to enter text instead of scrolling the damn menu over and over and over agian. This is driving me mad someone please help!