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 - a\n";
- std::cout << "Action 2 - b\n";
- std::cout << "Action 3 - c\n";
- std::cout << "Exit - x\n";
- std::cout << "Enter a,b,c to select action\nEnter x to exit\n";
- std::cin >> action;
- switch (action)
- {
- case 'a':
- std::cout << "User select Action 1\n";
- std::cout << "Boom!\n";
- break;
- case 'b':
- std::cout << "User select Action 2\n";
- std::cout << "OOps!!\n";
- break;
- case 'c':
- std::cout << "User select Action 3\n";
- std::cout << "Nothing :(\n";
- break;
- case 'x':
- break;
- default:
- std::cout << "Incorrect selection! Try again!\n";
- }
- } while (action != 'x');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement