Ok so I am quite sure everyone will find this stupidly simple but I am trying to learn C++ and am still in the MOST basic steps, just made it to Loop section in Jumping Into C++ E-book. Anyways here is my question that I need to answer (I am stuck on a practice problem):
Write a menu program that lets the user select from a list of options, and if the input is not one of the options, reprint the list...
*pertinent info: it works without the OR operator so essentially if "1" is the only option...
Thank you in advance to any help received!Code:#include <iostream> #include <string> using namespace std; int main() { string num; cout << "Please choose from the options: 1,2,3: "; cin >> num; while ( (num != ("1")) || (num != ("2")) || (num != ("3"))) { cout << "Wrong option--try again (1,2,3): "; cin >> num; } }



3Likes
LinkBack URL
About LinkBacks



