No Value Is Accepted

char guestType ()
{
char type;
cout << "Enter M if you are a member or N if you are not a member.";
cin >> type;
while (type != 'm' || 'M' || 'n' || 'N')
{
cout << "Please enter a valid answer: ";
cin >> type;
cout << endl;
}
return type;
}
No matter what I enter, nothing is accepted. Thanks!
1
2
// while (type != 'm' || 'M' || 'n' || 'N')
while( type != 'm' && type != 'M' && type != 'n' && type != 'N')

I was just thinking I would have to do that, thanks for confirming!
 
while (strchr("mMnN", type) == nullptr)

http://www.cplusplus.com/reference/cstring/strchr/
Last edited on
Topic archived. No new replies allowed.