Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <windows.h>
  4. using namespace std;
  5. int menu();
  6. int main()
  7. {
  8.  
  9.     int answer = menu();
  10.     switch (answer)
  11.     {
  12.     case 0: cout << "1" << endl; break;
  13.     case 1: cout << "2" << endl; break;
  14.     case 2: cout << "3" << endl; break;
  15.     case 3: cout << "4" << endl; return 0;
  16.     }
  17.     system("pause");
  18.     return 0;
  19. }
  20.  
  21. int menu() {
  22.     int key = 0;
  23.     int code;
  24.     do {
  25.         system("cls");
  26.         key = (key + 4) % 4;
  27.         if (key == 0) cout << "-> Draw a picture" << endl;
  28.         else  cout << "   Max, " << endl;
  29.  
  30.         if (key == 1) cout << "-> Draw graph" << endl;
  31.         else  cout << "   I am " << endl;
  32.  
  33.         if (key == 2) cout << "-> Draw a picture step-by-step" << endl;
  34.         else  cout << "   trolling " << endl;
  35.  
  36.         if (key == 3) cout << "-> Exit" << endl;
  37.         else  cout << "   you" << endl;
  38.  
  39.         code = _getch();
  40.         if (code == 224)
  41.         {
  42.             code = _getch();
  43.             if (code == 80) key++;
  44.             if (code == 72) key--;
  45.         }
  46.     } while (code != 13);
  47.     system("cls");
  48.     return key;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement