Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- char action{ 'x' };
- do
- {
- std::cout << "Action 1\t- a\n";
- std::cout << "Action 2\t- b\n";
- std::cout << "Action 3\t- c\n";
- std::cout << "Exit\t\t- x\n";
- std::cout << "\nEnter a,b,c to select action or x to exit\n";
- std::cin >> action;
- switch (action)
- {
- case 'a':
- std::cout << "User selected Action 1\n";
- std::cout << "Booom!\n";
- break;
- case 'b':
- std::cout << "User selected Action 2\n";
- std::cout << "OoopS!\n";
- break;
- case 'c':
- std::cout << "User selected Action 3\n";
- std::cout << "Hello!\n";
- break;
- case 'x':
- std::cout << "Exiting...\n";
- break;
- default:
- std::cout << "Incorrect menu item! Try again!\n";
- }
- } while (action != 'x');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement