Advertisement
Five_NT

ascii

Dec 20th, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.10 KB | None | 0 0
  1. #define ui unsigned int
  2. #define L 20
  3. #define C 30
  4. #define css char(201) // 01. ╔
  5. #define cds char(187) // 02. ╗
  6. #define csj char(200) // 03. ╚
  7. #define cdj char(188) // 04. ╝
  8. #define ori char(205) // 05. ═
  9. #define ver char(186) // 06. ║
  10. #define vsm char(204) // 07. ╠
  11. #define vdm char(185) // 08. ╣
  12. #define osm char(203) // 09. ╦
  13. #define ojm char(202) // 10. ╩
  14.  
  15.  
  16. void menu(unsigned int optiune)
  17. {
  18.  
  19.     #define start_title  10
  20.     #define start_op_adauga 2
  21.     #define start_op_editeaza 2
  22.     #define start_op_listare 2
  23.     #define start_op_stergere 2
  24.     #define start_op_cautare 2
  25.     #define lista 5
  26.     #define op_exit 2
  27.  
  28.     for (ui i = 0; i < L; i++)
  29.     {
  30.         cout << "   ";
  31.         for (ui j = 0; j < C; j++)
  32.         {
  33.             if (i == 0 || i == L - 1 || j == 0 || j == C - 1 || i == 2)
  34.             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN);
  35.             else
  36.             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15); // ALB
  37.  
  38.             if (a[i][j] == 1) cout << css;
  39.             else if (a[i][j] == 2) cout << cds;
  40.             else if (a[i][j] == 3) cout << csj;
  41.             else if (a[i][j] == 4) cout << cdj;
  42.             else if (a[i][j] == 5) cout << ori;
  43.             else if (a[i][j] == 6) cout << ver;
  44.             else if (a[i][j] == 7) cout << vsm;
  45.             else if (a[i][j] == 8) cout << vdm;
  46.             else if (a[i][j] == 9) cout << osm;
  47.             else if (a[i][j] == 10) cout << ojm;
  48.             else if (i == 1 && j > start_title - 1 && j < start_title + 10){
  49.             cout << "MANAGEMENT";
  50.             j = start_title + 9;
  51.             /*if (i == 1 && j == start_title) cout << "M";
  52.             if (i == 1 && j == start_title + 1) cout << "A";
  53.             if (i == 1 && j == start_title + 2) cout << "N";
  54.             if (i == 1 && j == start_title + 3) cout << "A";
  55.             if (i == 1 && j == start_title + 4) cout << "G";
  56.             if (i == 1 && j == start_title + 5) cout << "E";
  57.             if (i == 1 && j == start_title + 6) cout << "M";
  58.             if (i == 1 && j == start_title + 7) cout << "E";
  59.             if (i == 1 && j == start_title + 8) cout << "N";
  60.             if (i == 1 && j == start_title + 9) cout << "T";*/
  61.             }
  62.             else if (i == lista && j > start_op_adauga && j < start_op_adauga + 15)
  63.             {
  64.                 if (optiune == 1)
  65.                     SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 3);
  66.  
  67.                 cout << "1. Adauga copil";
  68.                 j = start_op_adauga + 15;
  69.                 SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  70.             }
  71.             else if (i == lista + 2 && j > start_op_editeaza && j < start_op_editeaza + 16)
  72.             {
  73.                 if (optiune == 2)
  74.                     SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 3);
  75.  
  76.                 cout << "2. Editeaza date";
  77.                 j = start_op_editeaza + 16;
  78.                 SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  79.             }
  80.             else if (i == lista + 4 && j > start_op_listare && j < start_op_listare + 16)
  81.             {
  82.                 if (optiune == 3)
  83.                     SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 3);
  84.  
  85.                 cout << "3. Listare copii";
  86.                 j = start_op_listare + 16;
  87.                 SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  88.             }
  89.             else if (i == lista + 6 && j > start_op_stergere && j < start_op_stergere + 17)
  90.             {
  91.                 if (optiune == 4)
  92.                     SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 3);
  93.                 cout << "4. Stergere copil";
  94.                 j = start_op_stergere + 17;
  95.                 SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  96.             }
  97.  
  98.             else if (i == lista + 8 && j > start_op_cautare && j < start_op_cautare + 16)
  99.             {
  100.                 if (optiune == 5)
  101.                     SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 3);
  102.                 cout << "5. Cautare copii";
  103.                 j = start_op_cautare + 16;
  104.                 SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  105.             }
  106.             else if (i == lista + 10 && j > op_exit && j < op_exit + 7)
  107.             {
  108.                 cout << "6. Exit";
  109.                 j = op_exit + 7;
  110.             }
  111.             else
  112.                 cout << " ";
  113.         }
  114.         cout << endl;
  115.     }
  116.  
  117.     SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15); // ALB
  118. }
  119.  
  120.  
  121. void desenare_lista()
  122. {
  123.     for (ui i = 0; i < C; i++)
  124.     {
  125.         a[0][i] = 5;
  126.         a[L - 1][i] = 5;
  127.         a[2][i] = 5;
  128.     }
  129.  
  130.     for (ui i = 0; i < L; i++)
  131.     {
  132.         a[i][0] = 6;
  133.         a[i][C - 1] = 6;
  134.     }
  135.  
  136.  
  137.     a[0][0] = 1;        // ╔
  138.     a[0][C - 1] = 2;    // ╗
  139.     a[L - 1][0] = 3;    // ╚
  140.     a[L - 1][C - 1] = 4;// ╝
  141.     a[2][0] = 7;        // ╠
  142.     a[2][C - 1] = 8;    // ╣
  143.  
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement