int userChoice(){
int choice;
cin>> choice;
while (choice!=1 && choice!=2){
cout<<"that is not a valid choice please choose again ";
cin>>choice;}
return choice;
}
the whole point of this is that if a user doesnt enter 1 or 2 then it tells them to enter 1 or 2 and wont exit until they do, it works if they enter the wrong number but if they enter a letter it just loops infinitly not giving them a chance to enter a 1 or 2 what am i doing wrong? thanks!