while (weather != 'S' || 'R' || 'W') {
cout << "Invalid input for weather" << endl;
std::cout << "Please enter today's weather [S]unny, [R]ainy, [W]indy: " << endl;
cin >> weather;
}
If weather is equal to S R or W I want it to continue on with the program but if its not S R or W then i want it to run the while statement. But even if the weather input is S R or W it runs the while statement anyway. Any advice?
Ive tried
while ((weather != 'S') || (weather != 'R') || (weather != 'W')) {
cout << "Invalid input for weather" << endl;
std::cout << "Please enter today's weather [S]unny, [R]ainy, [W]indy: " << endl;
cin >> weather;
}
but that didn't work either. I even attempted
while (weather != 'S') {
while (weather != 'R') {
while (weather != 'W')) {
cout << "Invalid input for weather" << endl;
std::cout << "Please enter today's weather [S]unny, [R]ainy, [W]indy: " << endl;
cin >> weather;
}
}
}
but to nothing seems to work.