Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <conio.h>
- #include <stdio.h>
- #include <windows.h>
- #include <cstdlib>
- HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
- COORD CursorPosition;
- int Romana();
- void gotoXY(int, int);
- void a();
- void b();
- void c();
- void n();
- void a_1();
- void a_2();
- void a_3();
- int main() {
- int menu_item = 0, run, x = 3, y = 5;
- bool running = true;
- system("cls");
- gotoXY(1, 1); printf("\x1b[31;47m Main Menu \x1b[31;0m");
- //------------------------
- gotoXY(3, 3); printf("\x1b[31;44mRomana \x1b[31;0m");
- gotoXY(3, 4); printf("\x1b[31;47mEngleza \x1b[31;0m");
- gotoXY(3, 5); printf("\x1b[31;47mExit \x1b[31;0m");
- while (running)
- {
- system("pause>nul"); // bitul null
- if (GetAsyncKeyState(VK_DOWN) && x != 5)
- {
- gotoXY(1, x); printf(" ");
- x++;
- if (x==3) {
- a();
- }
- else if (x == 4) {
- b();
- }
- else if (x == 5) {
- c();
- }
- menu_item++;
- continue;
- }
- if (GetAsyncKeyState(VK_UP) && x != 3)
- {
- gotoXY(1, x); printf(" ");
- x--;
- if (x == 3) {
- a();
- }
- else if (x == 4) {
- b();
- }
- else if (x == 5) {
- c();
- }
- menu_item--;
- continue;
- }
- if (GetAsyncKeyState(VK_RETURN)) {
- switch (menu_item) {
- case 0: {
- gotoXY(3, 8);
- Romana();
- break;
- }
- case 1: {
- gotoXY(3, 8);
- printf("Engleza");
- break;
- }
- case 2: {
- gotoXY(3, 8);
- printf("Programul se inchide!!!");
- running = false;
- }
- }
- }
- }
- gotoXY(3, 4);
- return 0;
- }
- int Romana() {
- int menu_item = 0, run, x = 3, y = 5;
- bool running = true;
- //------------------------
- gotoXY(13, 3); printf("\x1b[31;44m2007 \x1b[31;0m");
- gotoXY(13, 4); printf("\x1b[31;42m2008 \x1b[31;0m");
- gotoXY(13, 5); printf("\x1b[31;42mExit \x1b[31;0m");
- while (running)
- {
- system("pause>nul"); // bitul null
- if (GetAsyncKeyState(VK_DOWN) && x != 5)
- {
- gotoXY(11, x); printf(" ");
- x++;
- if (x == 3) {
- a_1();
- }
- else if (x == 4) {
- a_2();
- }
- else if (x == 5) {
- a_3();
- }
- menu_item++;
- continue;
- }
- if (GetAsyncKeyState(VK_UP) && x != 3)
- {
- gotoXY(11, x); printf(" ");
- x--;
- if (x == 3) {
- a_1();
- }
- else if (x == 4) {
- a_2();
- }
- else if (x == 5) {
- a_3();
- }
- menu_item--;
- continue;
- }
- if (GetAsyncKeyState(VK_RETURN)) {
- switch (menu_item) {
- case 0: {
- gotoXY(3, 8);
- Romana();
- break;
- }
- case 1: {
- gotoXY(3, 8);
- printf("Engleza");
- break;
- }
- case 2: {
- gotoXY(3, 8);
- printf("Programul se inchide!!!");
- running = false;
- }
- }
- }
- }
- gotoXY(3, 4);
- return 0;
- }
- void gotoXY(int x, int y)
- {
- CursorPosition.X = x;
- CursorPosition.Y = y;
- SetConsoleCursorPosition(console, CursorPosition);
- }
- void a() {
- gotoXY(3, 3); printf("\x1b[31;44mRomana \x1b[31;0m");
- gotoXY(3, 4); printf("\x1b[31;47mEngleza \x1b[31;0m");
- gotoXY(3, 5); printf("\x1b[31;47mExit \x1b[31;0m");
- }
- void b() {
- gotoXY(3, 3); printf("\x1b[31;47mRomana \x1b[31;0m");
- gotoXY(3, 4); printf("\x1b[31;44mEngleza \x1b[31;0m");
- gotoXY(3, 5); printf("\x1b[31;47mExit \x1b[31;0m");
- }
- void c() {
- gotoXY(3, 3); printf("\x1b[31;47mRomana \x1b[31;0m");
- gotoXY(3, 4); printf("\x1b[31;47mEngleza \x1b[31;0m");
- gotoXY(3, 5); printf("\x1b[31;44mExit \x1b[31;0m");
- }
- void a_1() {
- gotoXY(13, 3); printf("\x1b[31;44m2007 \x1b[31;0m");
- gotoXY(13, 4); printf("\x1b[31;42m2008 \x1b[31;0m");
- gotoXY(13, 5); printf("\x1b[31;42mExit \x1b[31;0m");
- }
- void a_2() {
- gotoXY(13, 3); printf("\x1b[31;42m2007 \x1b[31;0m");
- gotoXY(13, 4); printf("\x1b[31;44m2008 \x1b[31;0m");
- gotoXY(13, 5); printf("\x1b[31;42mExit \x1b[31;0m");
- }
- void a_3() {
- gotoXY(13, 3); printf("\x1b[31;42m2007 \x1b[31;0m");
- gotoXY(13, 4); printf("\x1b[31;42m2008 \x1b[31;0m");
- gotoXY(13, 5); printf("\x1b[31;44mExit \x1b[31;0m");
- }
Advertisement
Add Comment
Please, Sign In to add comment