Advertisement
ivanwidyan

Simple Game Menu Using Switch Case and Enums

Oct 19th, 2016
786
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>  
  2. using namespace std;
  3.  
  4. int main() {
  5.     int input = 0;
  6.     enum menuLists {
  7.         Play = 1, Option = 2, Exit = 3
  8.     };
  9.  
  10.     cout << "SIMPLE GAME MENU " << endl;
  11.     cout << "1. Play" << endl;
  12.     cout << "2. Option" << endl;
  13.     cout << "3. Exit" << endl;
  14.     cout << "Type your number: ";
  15.     cin >> input;
  16.     switch (input)
  17.     {
  18.     case Play:
  19.         cout << "You choose play" << endl;
  20.         break;
  21.     case Option:
  22.         cout << "You choose Option" << endl;
  23.         break;
  24.     case Exit:
  25.         cout << "You choose Exit" << endl;
  26.         break;
  27.     default:
  28.         cout << "Type the correct number" << endl;
  29.         break;
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement