---------------------------- Menu ------------------------- 1.Option 1 2.Option 2 3.Option 3 4.Option 4 5.Help 6.Quit ----------------------------------------------------------- Please Enter You Choice (1-6):
#include <iostream> using namespace std; int main() { int Number; int Menu; cout << "----------------menu------------------" << endl; cout << " 1.Option 1 " << endl; cout << " 2.Option 2 " << endl; cout << " 3.Option 2 " << endl; cout << " 4.Option 4 " << endl; cout << " 5.Help " << endl; cout << " 6.Quit " << endl; cout << "---------------------------------------" << endl; cout << " Please Enter You Choice (1-6): "; cin >>Number; switch (Number) { case 1 : case 2: case 3: case 4: case 5: break; case 6: cout << "Thank you for choosing our program " << endl; break; default: cout << "Invalid choice. You need to select an option between 1 and 6" << endl; break; } system("pause"); return 0; }
#include <iostream> using namespace std; int main() { int Number; int Menu; cout << "----------------menu------------------" << endl; cout << " 1.Option 1 " << endl; cout << " 2.Option 2 " << endl; cout << " 3.Option 2 " << endl; cout << " 4.Option 4 " << endl; cout << " 5.Help " << endl; cout << " 6.Quit " << endl; cout << "---------------------------------------" << endl; do { cout << " Please Enter You Choice (1-6): "; cin >> Number; switch (Number) { case 1: cout << "You chose option 1 " << endl; cout << "----------------menu------------------" << endl; cout << " 1.Option 1 " << endl; cout << " 2.Option 2 " << endl; cout << " 3.Option 2 " << endl; cout << " 4.Option 4 " << endl; cout << " 5.Help " << endl; cout << " 6.Quit " << endl; cout << "---------------------------------------" << endl; break; case 2: cout << "You chose option 2 " << endl; cout << "----------------menu------------------" << endl; cout << " 1.Option 1 " << endl; cout << " 2.Option 2 " << endl; cout << " 3.Option 2 " << endl; cout << " 4.Option 4 " << endl; cout << " 5.Help " << endl; cout << " 6.Quit " << endl; cout << "---------------------------------------" << endl; break; case 3: cout << "You chose option 3 " << endl; cout << "----------------menu------------------" << endl; cout << " 1.Option 1 " << endl; cout << " 2.Option 2 " << endl; cout << " 3.Option 2 " << endl; cout << " 4.Option 4 " << endl; cout << " 5.Help " << endl; cout << " 6.Quit " << endl; cout << "---------------------------------------" << endl; break; case 4: cout << "You chose option 4 " << endl; cout << "----------------menu------------------" << endl; cout << " 1.Option 1 " << endl; cout << " 2.Option 2 " << endl; cout << " 3.Option 2 " << endl; cout << " 4.Option 4 " << endl; cout << " 5.Help " << endl; cout << " 6.Quit " << endl; cout << "---------------------------------------" << endl; break; case 5: cout << "You chose option 5 " << endl; cout << "----------------menu------------------" << endl; cout << " 1.Option 1 " << endl; cout << " 2.Option 2 " << endl; cout << " 3.Option 2 " << endl; cout << " 4.Option 4 " << endl; cout << " 5.Help " << endl; cout << " 6.Quit " << endl; cout << "---------------------------------------" << endl; break; break; case 6: cout << "Thank you for choosing our program " << endl; break; default: cout << "Invalid choice. You need to select an option between 1 and 6" << endl; cout << "----------------menu------------------" << endl; cout << " 1.Option 1 " << endl; cout << " 2.Option 2 " << endl; cout << " 3.Option 2 " << endl; cout << " 4.Option 4 " << endl; cout << " 5.Help " << endl; cout << " 6.Quit " << endl; cout << "---------------------------------------" << endl; break; } } while (Number!= 6); system("pause"); return 0; } </iostream>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)