I am just beginning and going through Jumping Into C++. I am working #2 in chapter 5 which states... "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"
No matter what I enter the loop never breaks. I am pretty sure my "while" line is not right but I don't know. I know this is elementary stuff but I want to understand the easy stuff before it gets really hairy.Code:#include <iostream> #include <string> using namespace std; int main() { string input = "unknown"; while ( input != "1" || input != "2" || input != "3" || input != "4" || input != "5") { cout << "file (1)\t edit (2)\t view (3)\t search (4)\t project (5)\n"; cout << "Select a function: "; cin >> input; } }



LinkBack URL
About LinkBacks



