Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <conio.h>
- #include <iostream>
- #include <windows.h>
- using namespace std;
- #define KEY_UP 72
- #define KEY_DOWN 80
- #define KEY_LEFT 75
- #define KEY_RIGHT 77
- #define KEY_RETURN 13
- void admin_login()
- {
- system("cls");
- std::string username, password;
- /*gotoxy(console::width/2-10,console::height/2-3);*/
- std::cout << "nUsername: ";
- std::cin >> username;
- std::cout << "nPassword: ";
- std::cin >> password;
- }
- int main()
- {
- int c = 0;
- int line = 0;
- std::string menu_line[] = { "Admin login", "Guest login", "Change color theme", "Exit" };
- while(1)
- {
- system("cls");
- for(int i = 0 ; i < 4 ; i++)
- {
- if(i == line)
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),12);
- else
- SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
- std::cout << menu_line[i] << 'n';
- }
- switch((c=getch()))
- {
- case KEY_UP:
- --line;
- if(line == -1)
- line = 3;
- break;
- case KEY_DOWN:
- ++line;
- if(line == 4)
- line = 0;
- break;
- case KEY_RETURN:
- switch(line)
- {
- case 0:
- system("cls");
- admin_login();
- break;
- }
- break;
- default:
- cout << endl << "null" << endl; // not arrow
- system("pause");
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement