S
SB
This while loop keeps repeating even when a correct character is entered....
cout<<endl<<"What day would you like to schedule the appointment?"<<endl;
cout<<endl<<"Enter 'M' for Monday, 'T' for Tuesday, 'W' for Wednesday, 'H'
for Thursday \n"<<
"and 'F' for Friday: ";
cin>>day;
while (day != "M" || day != "m" || day != "T" || day != "t" ||
day != "W" || day != "w" || day != "H" || day != "h" ||
day != "F" || day != "f")
{
cout<<endl<<"Enter 'M' for Monday, 'T' for Tuesday, 'W' for Wednesday,
'H' for Thursday \n"<<
"and 'F' for Friday: ";
cin>>day;
}
cout<<endl<<"You entered "<<day<<endl;
No matter what character is input, it repeats. If I check for just "M" and
enter that it works. As soon as I add the first || it fails. What is wrong?
Thanks!
cout<<endl<<"What day would you like to schedule the appointment?"<<endl;
cout<<endl<<"Enter 'M' for Monday, 'T' for Tuesday, 'W' for Wednesday, 'H'
for Thursday \n"<<
"and 'F' for Friday: ";
cin>>day;
while (day != "M" || day != "m" || day != "T" || day != "t" ||
day != "W" || day != "w" || day != "H" || day != "h" ||
day != "F" || day != "f")
{
cout<<endl<<"Enter 'M' for Monday, 'T' for Tuesday, 'W' for Wednesday,
'H' for Thursday \n"<<
"and 'F' for Friday: ";
cin>>day;
}
cout<<endl<<"You entered "<<day<<endl;
No matter what character is input, it repeats. If I check for just "M" and
enter that it works. As soon as I add the first || it fails. What is wrong?
Thanks!