candrei98

Untitled

Dec 10th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.63 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.     gotoXY(1, 3); printf("\x1b[31;44m->\x1b[31;0m");
  25.     //------------------------
  26.  
  27.     gotoXY(3, 3);  printf("\x1b[31;44mRomana  \x1b[31;0m");
  28.     gotoXY(3, 4);  printf("\x1b[31;47mEngleza \x1b[31;0m");
  29.     gotoXY(3, 5);  printf("\x1b[31;47mExit    \x1b[31;0m");
  30.  
  31.     while (running)
  32.     {
  33.         system("pause>nul"); // bitul null
  34.  
  35.  
  36.         if (GetAsyncKeyState(VK_DOWN) && x != 5)
  37.         {
  38.             gotoXY(1, x); printf("  ");
  39.             x++;
  40.             if (x==3) {
  41.                 a();
  42.             }
  43.             else if (x == 4) {
  44.                 b();
  45.             }
  46.             else if (x == 5) {
  47.                 c();
  48.             }
  49.  
  50.             gotoXY(1, x); printf("\x1b[31;44m->\x1b[31;0m");
  51.             menu_item++;
  52.             continue;
  53.  
  54.         }
  55.  
  56.         if (GetAsyncKeyState(VK_UP) && x != 3)
  57.         {
  58.             gotoXY(1, x); printf("  ");
  59.             x--;
  60.             if (x == 3) {
  61.                 a();
  62.             }
  63.             else if (x == 4) {
  64.                 b();
  65.             }
  66.             else if (x == 5) {
  67.                 c();
  68.             }
  69.             gotoXY(1, x); printf("\x1b[31;44m->\x1b[31;0m");
  70.             menu_item--;
  71.             continue;
  72.         }
  73.  
  74.  
  75.         if (GetAsyncKeyState(VK_RETURN)) {
  76.  
  77.             switch (menu_item) {
  78.  
  79.             case 0: {
  80.  
  81.                 gotoXY(3, 8);
  82.                 Romana();
  83.                 break;
  84.             }
  85.  
  86.  
  87.             case 1: {
  88.                 gotoXY(3, 8);
  89.                 printf("Engleza");
  90.                 break;
  91.             }
  92.  
  93.             case 2: {
  94.                 gotoXY(3, 8);
  95.                 printf("Programul se inchide!!!");
  96.                 running = false;
  97.             }
  98.  
  99.  
  100.  
  101.             }
  102.  
  103.         }
  104.  
  105.     }
  106.  
  107.     gotoXY(3, 4);
  108.  
  109.  
  110.     return 0;
  111. }
  112.  
  113.  
  114. int Romana() {
  115.     int menu_item = 0, run, x = 3, y = 5;
  116.     bool running = true;
  117.     gotoXY(11, 3); printf("\x1b[31;44m->\x1b[31;0m");
  118.     //------------------------
  119.  
  120.     gotoXY(13, 3);  printf("\x1b[31;44m2007 \x1b[31;0m");
  121.     gotoXY(13, 4);  printf("\x1b[31;42m2008 \x1b[31;0m");
  122.     gotoXY(13, 5);  printf("\x1b[31;42mExit \x1b[31;0m");
  123.  
  124.     while (running)
  125.     {
  126.         system("pause>nul"); // bitul null
  127.  
  128.  
  129.         if (GetAsyncKeyState(VK_DOWN) && x != 5)
  130.         {
  131.             gotoXY(11, x); printf("  ");
  132.             x++;
  133.             if (x == 3) {
  134.                 a_1();
  135.             }
  136.             else if (x == 4) {
  137.                 a_2();
  138.             }
  139.             else if (x == 5) {
  140.                 a_3();
  141.             }
  142.  
  143.             gotoXY(11, x); printf("\x1b[31;44m->\x1b[31;0m");
  144.             menu_item++;
  145.             continue;
  146.  
  147.         }
  148.  
  149.         if (GetAsyncKeyState(VK_UP) && x != 3)
  150.         {
  151.             gotoXY(11, x); printf("  ");
  152.             x--;
  153.             if (x == 3) {
  154.                 a_1();
  155.             }
  156.             else if (x == 4) {
  157.                 a_2();
  158.             }
  159.             else if (x == 5) {
  160.                 a_3();
  161.             }
  162.             gotoXY(11, x); printf("\x1b[31;44m->\x1b[31;0m");
  163.             menu_item--;
  164.             continue;
  165.         }
  166.  
  167.  
  168.         if (GetAsyncKeyState(VK_RETURN)) {
  169.  
  170.             switch (menu_item) {
  171.  
  172.             case 0: {
  173.  
  174.                 gotoXY(3, 8);
  175.                 Romana();
  176.                 break;
  177.             }
  178.  
  179.  
  180.             case 1: {
  181.                 gotoXY(3, 8);
  182.                 printf("Engleza");
  183.                 break;
  184.             }
  185.  
  186.             case 2: {
  187.                 gotoXY(3, 8);
  188.                 printf("Programul se inchide!!!");
  189.                 running = false;
  190.             }
  191.  
  192.  
  193.  
  194.             }
  195.  
  196.         }
  197.  
  198.     }
  199.  
  200.     gotoXY(3, 4);
  201.  
  202.  
  203.     return 0;
  204. }
  205.  
  206.  
  207. /*int Romana() {
  208.     int menu_item = 0, run, x = 3;
  209.     bool running = true;
  210.     gotoXY(11, 3); printf("\x1b[31;44m->\x1b[31;0m");
  211.     //------------------------
  212.  
  213.     while (running)
  214.     {
  215.         gotoXY(13, 3);  printf("\x1b[31;42m2007 \x1b[31;0m");
  216.         gotoXY(13, 4);  printf("\x1b[31;42m2008 \x1b[31;0m");
  217.         gotoXY(13, 5);  printf("\x1b[31;42mExit \x1b[31;0m");
  218.  
  219.         system("pause>nul"); // bitul null
  220.  
  221.         if (GetAsyncKeyState(VK_DOWN) && x != 5)
  222.         {
  223.             gotoXY(13, x); printf("  ");
  224.             x++;
  225.             if (x == 3) {
  226.                 a_1();
  227.             }
  228.             else if (x == 4) {
  229.                 a_2();
  230.             }
  231.             else if (x == 5) {
  232.                 a_3();
  233.             }
  234.             gotoXY(13, x); printf("\x1b[31;44m->\x1b[31;0m");
  235.             menu_item++;
  236.             continue;
  237.  
  238.         }
  239.  
  240.         if (GetAsyncKeyState(VK_UP) && x != 3)
  241.         {
  242.             gotoXY(13, x); printf("  ");
  243.             x--;
  244.             if (x == 3) {
  245.                 a_1();
  246.             }
  247.             else if (x == 4) {
  248.                 a_2();
  249.             }
  250.             else if (x == 5) {
  251.                 a_3();
  252.             }
  253.             gotoXY(13, x); printf("\x1b[31;44m->\x1b[31;0m");
  254.             menu_item--;
  255.             continue;
  256.         }
  257.  
  258.         if (GetAsyncKeyState(VK_RETURN)) {
  259.  
  260.             switch (menu_item) {
  261.  
  262.             case 0: {
  263.  
  264.                 gotoXY(3, 8);
  265.                 printf("Test");
  266.                 break;
  267.             }
  268.  
  269.  
  270.             case 1: {
  271.                 gotoXY(3, 8);
  272.                 printf("TEst");
  273.                 break;
  274.             }
  275.  
  276.             case 2: {
  277.                 gotoXY(3, 8);
  278.                 printf("Programul se inchide!!!");
  279.                 running = false;
  280.             }
  281.  
  282.  
  283.             }
  284.  
  285.         }
  286.  
  287.     }
  288.  
  289.     gotoXY(3, 4);
  290.  
  291.  
  292.     return 0;
  293. }
  294. */
  295. void gotoXY(int x, int y)
  296. {
  297.     CursorPosition.X = x;
  298.     CursorPosition.Y = y;
  299.     SetConsoleCursorPosition(console, CursorPosition);
  300. }
  301.  
  302. void a() {
  303.     gotoXY(3, 3);  printf("\x1b[31;44mRomana  \x1b[31;0m");
  304.     gotoXY(3, 4);  printf("\x1b[31;47mEngleza \x1b[31;0m");
  305.     gotoXY(3, 5);  printf("\x1b[31;47mExit    \x1b[31;0m");
  306. }
  307.  
  308. void b() {
  309.     gotoXY(3, 3);  printf("\x1b[31;47mRomana  \x1b[31;0m");
  310.     gotoXY(3, 4);  printf("\x1b[31;44mEngleza \x1b[31;0m");
  311.     gotoXY(3, 5);  printf("\x1b[31;47mExit    \x1b[31;0m");
  312. }
  313.  
  314. void c() {
  315.     gotoXY(3, 3);  printf("\x1b[31;47mRomana  \x1b[31;0m");
  316.     gotoXY(3, 4);  printf("\x1b[31;47mEngleza \x1b[31;0m");
  317.     gotoXY(3, 5);  printf("\x1b[31;44mExit    \x1b[31;0m");
  318. }
  319.  
  320. void a_1() {
  321.     gotoXY(13, 3);  printf("\x1b[31;44m2007 \x1b[31;0m");
  322.     gotoXY(13, 4);  printf("\x1b[31;42m2008 \x1b[31;0m");
  323.     gotoXY(13, 5);  printf("\x1b[31;42mExit \x1b[31;0m");
  324. }
  325.  
  326. void a_2() {
  327.     gotoXY(13, 3);  printf("\x1b[31;42m2007 \x1b[31;0m");
  328.     gotoXY(13, 4);  printf("\x1b[31;44m2008 \x1b[31;0m");
  329.     gotoXY(13, 5);  printf("\x1b[31;42mExit \x1b[31;0m");
  330. }
  331.  
  332. void a_3() {
  333.     gotoXY(13, 3);  printf("\x1b[31;42m2007 \x1b[31;0m");
  334.     gotoXY(13, 4);  printf("\x1b[31;42m2008 \x1b[31;0m");
  335.     gotoXY(13, 5);  printf("\x1b[31;44mExit \x1b[31;0m");
  336. }
Advertisement
Add Comment
Please, Sign In to add comment