candrei98

Untitled

Dec 10th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.96 KB | None | 0 0
  1. #include <conio.h>
  2. #include <stdio.h>
  3. #include <windows.h>
  4. #include <cstdlib>
  5.  
  6. HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
  7. COORD CursorPosition;
  8.  
  9. int Romana();
  10. void gotoXY(int, int);
  11. void a();
  12. void b();
  13. void c();
  14. void n();
  15. void a_1();
  16. void a_2();
  17. void a_3();
  18.  
  19. int main() {
  20.     int menu_item = 0, run, x = 3, y = 5;
  21.     bool running = true;
  22.     system("cls");
  23.     gotoXY(1, 1); printf("\x1b[31;47m Main Menu \x1b[31;0m");
  24.     //------------------------
  25.  
  26.     gotoXY(3, 3);  printf("\x1b[31;44mRomana  \x1b[31;0m");
  27.     gotoXY(3, 4);  printf("\x1b[31;47mEngleza \x1b[31;0m");
  28.     gotoXY(3, 5);  printf("\x1b[31;47mExit    \x1b[31;0m");
  29.  
  30.     while (running)
  31.     {
  32.         system("pause>nul"); // bitul null
  33.  
  34.  
  35.         if (GetAsyncKeyState(VK_DOWN) && x != 5)
  36.         {
  37.             gotoXY(1, x); printf("  ");
  38.             x++;
  39.             if (x==3) {
  40.                 a();
  41.             }
  42.             else if (x == 4) {
  43.                 b();
  44.             }
  45.             else if (x == 5) {
  46.                 c();
  47.             }
  48.             menu_item++;
  49.             continue;
  50.  
  51.         }
  52.  
  53.         if (GetAsyncKeyState(VK_UP) && x != 3)
  54.         {
  55.             gotoXY(1, x); printf("  ");
  56.             x--;
  57.             if (x == 3) {
  58.                 a();
  59.             }
  60.             else if (x == 4) {
  61.                 b();
  62.             }
  63.             else if (x == 5) {
  64.                 c();
  65.             }
  66.             menu_item--;
  67.             continue;
  68.         }
  69.  
  70.  
  71.         if (GetAsyncKeyState(VK_RETURN)) {
  72.  
  73.             switch (menu_item) {
  74.  
  75.             case 0: {
  76.  
  77.                 gotoXY(3, 8);
  78.                 Romana();
  79.                 break;
  80.             }
  81.  
  82.  
  83.             case 1: {
  84.                 gotoXY(3, 8);
  85.                 printf("Engleza");
  86.                 break;
  87.             }
  88.  
  89.             case 2: {
  90.                 gotoXY(3, 8);
  91.                 printf("Programul se inchide!!!");
  92.                 running = false;
  93.             }
  94.  
  95.  
  96.  
  97.             }
  98.  
  99.         }
  100.  
  101.     }
  102.  
  103.     gotoXY(3, 4);
  104.  
  105.  
  106.     return 0;
  107. }
  108.  
  109.  
  110. int Romana() {
  111.     int menu_item = 0, run, x = 3, y = 5;
  112.     bool running = true;
  113.     //------------------------
  114.  
  115.     gotoXY(13, 3);  printf("\x1b[31;44m2007 \x1b[31;0m");
  116.     gotoXY(13, 4);  printf("\x1b[31;42m2008 \x1b[31;0m");
  117.     gotoXY(13, 5);  printf("\x1b[31;42mExit \x1b[31;0m");
  118.  
  119.     while (running)
  120.     {
  121.         system("pause>nul"); // bitul null
  122.  
  123.  
  124.         if (GetAsyncKeyState(VK_DOWN) && x != 5)
  125.         {
  126.             gotoXY(11, x); printf("  ");
  127.             x++;
  128.             if (x == 3) {
  129.                 a_1();
  130.             }
  131.             else if (x == 4) {
  132.                 a_2();
  133.             }
  134.             else if (x == 5) {
  135.                 a_3();
  136.             }
  137.             menu_item++;
  138.             continue;
  139.  
  140.         }
  141.  
  142.         if (GetAsyncKeyState(VK_UP) && x != 3)
  143.         {
  144.             gotoXY(11, x); printf("  ");
  145.             x--;
  146.             if (x == 3) {
  147.                 a_1();
  148.             }
  149.             else if (x == 4) {
  150.                 a_2();
  151.             }
  152.             else if (x == 5) {
  153.                 a_3();
  154.             }
  155.             menu_item--;
  156.             continue;
  157.         }
  158.  
  159.  
  160.         if (GetAsyncKeyState(VK_RETURN)) {
  161.  
  162.             switch (menu_item) {
  163.  
  164.             case 0: {
  165.  
  166.                 gotoXY(3, 8);
  167.                 Romana();
  168.                 break;
  169.             }
  170.  
  171.  
  172.             case 1: {
  173.                 gotoXY(3, 8);
  174.                 printf("Engleza");
  175.                 break;
  176.             }
  177.  
  178.             case 2: {
  179.                 gotoXY(3, 8);
  180.                 printf("Programul se inchide!!!");
  181.                 running = false;
  182.             }
  183.  
  184.  
  185.  
  186.             }
  187.  
  188.         }
  189.  
  190.     }
  191.  
  192.     gotoXY(3, 4);
  193.  
  194.  
  195.     return 0;
  196. }
  197.  
  198. void gotoXY(int x, int y)
  199. {
  200.     CursorPosition.X = x;
  201.     CursorPosition.Y = y;
  202.     SetConsoleCursorPosition(console, CursorPosition);
  203. }
  204.  
  205. void a() {
  206.     gotoXY(3, 3);  printf("\x1b[31;44mRomana  \x1b[31;0m");
  207.     gotoXY(3, 4);  printf("\x1b[31;47mEngleza \x1b[31;0m");
  208.     gotoXY(3, 5);  printf("\x1b[31;47mExit    \x1b[31;0m");
  209. }
  210.  
  211. void b() {
  212.     gotoXY(3, 3);  printf("\x1b[31;47mRomana  \x1b[31;0m");
  213.     gotoXY(3, 4);  printf("\x1b[31;44mEngleza \x1b[31;0m");
  214.     gotoXY(3, 5);  printf("\x1b[31;47mExit    \x1b[31;0m");
  215. }
  216.  
  217. void c() {
  218.     gotoXY(3, 3);  printf("\x1b[31;47mRomana  \x1b[31;0m");
  219.     gotoXY(3, 4);  printf("\x1b[31;47mEngleza \x1b[31;0m");
  220.     gotoXY(3, 5);  printf("\x1b[31;44mExit    \x1b[31;0m");
  221. }
  222.  
  223. void a_1() {
  224.     gotoXY(13, 3);  printf("\x1b[31;44m2007 \x1b[31;0m");
  225.     gotoXY(13, 4);  printf("\x1b[31;42m2008 \x1b[31;0m");
  226.     gotoXY(13, 5);  printf("\x1b[31;42mExit \x1b[31;0m");
  227. }
  228.  
  229. void a_2() {
  230.     gotoXY(13, 3);  printf("\x1b[31;42m2007 \x1b[31;0m");
  231.     gotoXY(13, 4);  printf("\x1b[31;44m2008 \x1b[31;0m");
  232.     gotoXY(13, 5);  printf("\x1b[31;42mExit \x1b[31;0m");
  233. }
  234.  
  235. void a_3() {
  236.     gotoXY(13, 3);  printf("\x1b[31;42m2007 \x1b[31;0m");
  237.     gotoXY(13, 4);  printf("\x1b[31;42m2008 \x1b[31;0m");
  238.     gotoXY(13, 5);  printf("\x1b[31;44mExit \x1b[31;0m");
  239. }
Advertisement
Add Comment
Please, Sign In to add comment