Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <windows.h>
- using namespace std;
- int menu();
- int main()
- {
- int answer = menu();
- switch (answer)
- {
- case 0: cout << "1" << endl; break;
- case 1: cout << "2" << endl; break;
- case 2: cout << "3" << endl; break;
- case 3: cout << "4" << endl; return 0;
- }
- system("pause");
- return 0;
- }
- int menu() {
- int key = 0;
- int code;
- do {
- system("cls");
- key = (key + 4) % 4;
- if (key == 0) cout << "-> Draw a picture" << endl;
- else cout << " Max, " << endl;
- if (key == 1) cout << "-> Draw graph" << endl;
- else cout << " I am " << endl;
- if (key == 2) cout << "-> Draw a picture step-by-step" << endl;
- else cout << " trolling " << endl;
- if (key == 3) cout << "-> Exit" << endl;
- else cout << " you" << endl;
- code = _getch();
- if (code == 224)
- {
- code = _getch();
- if (code == 80) key++;
- if (code == 72) key--;
- }
- } while (code != 13);
- system("cls");
- return key;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement