edgarrii

course

May 15th, 2020
545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 46.01 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <Windows.h>
  4. #include <fstream>
  5. #include <conio.h>
  6. #include <iomanip>
  7.  
  8.  
  9. using namespace std;
  10.  
  11. struct Account {
  12.     string log;
  13.     string pas;
  14.     int prava;
  15. };
  16.  
  17. struct Project {
  18.     string name_project;
  19.     string vid_rab;
  20.     string FIO;
  21.     string kolvo_chas;
  22.     string stoimost_chas;
  23. };
  24.  
  25. struct IndvZad {
  26.     string name_proj;
  27.     int kolvo_sotrud;
  28.     int stoimost_proekta;
  29.     int perechen_rabot[5];
  30.     int perechen_rabot_st[5] = { 0, 0, 0 ,0 ,0 };
  31. };
  32.  
  33. int fillAccounts(Account*, int);
  34. int enter();
  35. string proverkaLogina(Account*, int);
  36. string proverkaRegisterPass(string);
  37. int fillFileAccount(Account*, int);
  38. string proverkaLogin(Account*, int);
  39. string proverkaParolya(Account*, int, string);
  40. string enterPassword();
  41. int menuAdmin(Account*, int, string);
  42. int vivodMenuAdmin(string);
  43. void menuUserAdmin(Account*, int);
  44. int vivodMenuAccounta();
  45. int vivodInfUser(Account*, int);
  46. int proverkaPravPolzovatelya();
  47. int editAccount(Account*, int);
  48. int viborEditAccount(Account*, int);
  49. void dataChangeMenu();
  50. void fillProj(Project*, int);
  51. int vivodMenuEdita();
  52. void vivodProj(Project*, int);
  53. int addProject(Project*, int);
  54. string enterFIO();
  55. string enterWords();
  56. string proverkaVidaRabot();
  57. string proverkaPricePerHour();
  58. int editProj(Project*, int);
  59. int viborEdita(Project*, int);
  60. void fillFileProj(Project*, int);
  61. void menuUser(string);
  62. int vivodMenuUser(string);
  63. int vivodSearchMenu();
  64. void searchMenu(Project*, int, int);
  65. void vivodProj1(Project*, int);
  66. int vivodSortMenu();
  67. void menuSort(Project*, int, int);
  68. void individualEx(Project*, int);
  69.  
  70.  
  71. int main() {
  72.     setlocale(0, "rus");
  73.     ifstream fin;
  74.     ofstream fout;
  75.     ifstream check;
  76.     check.open("Project.txt");
  77.     if (!check) {
  78.         fout.open("Project.txt", ios::out);
  79.         fout.close();
  80.     }
  81.     check.close();
  82.     check.open("registr.txt");
  83.     if (!check) {
  84.         fout.open("registr.txt", ios::out);
  85.         fout.close();
  86.     }
  87.     check.close();
  88.     ifstream file("Project.txt", ios::in);
  89.     file.seekg(0, ios::end);
  90.     int file_size = file.tellg();
  91.     if (file_size == 0) {
  92.         ofstream file1("Project.txt", ios::out);
  93.         file1 << "0" << endl;
  94.         file1.close();
  95.     }
  96.     file.close();
  97.     ifstream f("registr.txt", ios::in);
  98.     f.seekg(0, ios::end);
  99.     file_size = f.tellg();
  100.     if (file_size == 0) {
  101.         ofstream file1("registr.txt", ios::out);
  102.         file1 << "0" << endl;
  103.         file1 << "edgar" << endl;
  104.         file1 << "12345" << endl;
  105.         file1 << "1" << endl;
  106.         file1 << "1" << endl;
  107.         file1.close();
  108.     }
  109.     f.close();
  110.     fin.open("registr.txt");
  111.     fin.seekg(-3, ios::end);
  112.     int n;
  113.     fin >> n;
  114.     fin.close();
  115.     Account* Acc = new Account[n];
  116.     fillAccounts(Acc, n);
  117.     while (true) {
  118.         string login, pass;
  119.         int key = enter();
  120.         if (key == 2) { cout << "Досвидания!!!"; return 0; }
  121.         else
  122.             if (key == 1) {
  123.                 Account* t = new Account[n + 1];
  124.                 copy(Acc, Acc + n, t);
  125.                 delete[]Acc;
  126.                 Acc = t;
  127.                 t = NULL;
  128.                 fillAccounts(Acc, n);
  129.                 login = proverkaLogina(Acc, n);
  130.                 pass = proverkaRegisterPass(login);
  131.                 fstream clear_file("registr.txt", ios::out);
  132.                 clear_file.close();
  133.                 Acc[n].log = login; Acc[n].pas = pass; Acc[n].prava = 0;
  134.                 fillFileAccount(Acc, n);
  135.                 n++;
  136.                 system("cls");
  137.             }
  138.             else
  139.                 if (key == 0) {
  140.                     login = proverkaLogin(Acc, n);
  141.                     pass = proverkaParolya(Acc, n, login);
  142.                     if (pass == "-666") continue;
  143.                     int nomer = -1;
  144.                     for (int i = 0; i < n; i++)
  145.                         if (Acc[i].log == login) { nomer = i; }
  146.                     if (Acc[nomer].prava == 1) {
  147.                         menuAdmin(Acc, n, login);
  148.                     }
  149.                     else {
  150.                         menuUser(login);
  151.                     }
  152.                 }
  153.     }
  154.     return 0;
  155. }
  156.  
  157. int fillAccounts(Account* Acc, int n) {
  158.     ifstream fi;
  159.     fi.open("registr.txt", ios::in);
  160.     int k, prav;
  161.     string lo, pa;
  162.     fi >> k;
  163.     for (int i = 0; i < n; i++) {
  164.         fi >> lo;
  165.         fi >> pa;
  166.         fi >> prav;
  167.         Acc[i].log = lo;
  168.         Acc[i].pas = pa;
  169.         Acc[i].prava = prav;
  170.         fi >> k;
  171.     }
  172.     fi.close();
  173.     return 0;
  174. }
  175.  
  176. int enter() {
  177.     int kol = 0, key = 0;
  178.     while (true) {
  179.         cout << "Стрелками ВВЕРХ и ВНИЗ выберите меню" << endl;
  180.         kol = (kol + 3) % 3;
  181.         if (kol == 0) { cout << " -- Войти в уже существующий аккаунт" << endl; }
  182.         else cout << " Войти в уже существующий аккаунт" << endl;
  183.  
  184.         if (kol == 1) { cout << " -- Создать новый аккаунт" << endl; }
  185.         else cout << " Создать новый аккаунт" << endl;
  186.  
  187.         if (kol == 2) { cout << " -- Завершить программу" << endl; }
  188.         else { cout << " Завершить программу" << endl; }
  189.  
  190.         key = _getch();
  191.         if (key == 224) {
  192.             key = _getch();
  193.             if (key == 72) kol--;
  194.             if (key == 80) kol++;
  195.         }
  196.         if (key == 13) { system("cls"); return kol; }
  197.         system("cls");
  198.     }
  199. }
  200.  
  201. string proverkaLogina(Account* Acc, int n1) {
  202.     cout << "Логин должне содержать только буквы латинского алфавита, цифры." << endl;
  203.     cout << "Введите ваш логин: ";
  204.     string s;
  205.     while (true) {
  206.         int prov = 0;
  207.         getline(cin, s);
  208.         int n = s.length();
  209.         for (int i = 0; i < n; i++) {
  210.             if ((s[i] < 'a' || s[i] > 'z') && (s[i] < 'A' || s[i] > 'Z') && (s[i] < '0' || s[i] > '9')) {
  211.                 prov = 1;
  212.             }
  213.         }
  214.  
  215.         for (int i = 0; i < n1; i++) {
  216.             if (s == Acc[i].log) prov = 3;
  217.         }
  218.  
  219.  
  220.         if (prov == 3) {
  221.             system("cls");
  222.             cout << "Такой логин уже существует" << endl;
  223.             cout << "Логин может содержать буквы латинского алфавита, цифры" << endl;
  224.             cout << "Введите логин: ";
  225.         }
  226.         else
  227.             if (prov == 0) { return s; }
  228.             else {
  229.                 system("cls");
  230.                 cout << "Логин может содержать буквы латинского алфавита, цифры" << endl;
  231.                 cout << "Введите логин: ";
  232.             }
  233.     }
  234. }
  235.  
  236. string proverkaRegisterPass(string login) {
  237.     system("cls");
  238.     cout << "Логин: " << login << endl;
  239.     cout << "Пароль должен состоять из более цифр и латинских буквы." << endl;
  240.     cout << "Введите пароль: ";
  241.     string s;
  242.     while (true) {
  243.         int prov = 0, kolchi = 0, bol = 0, mal = 0;
  244.         getline(cin, s);
  245.         int n = s.length();
  246.         for (int i = 0; i < n; i++) {
  247.             if ((s[i] < 'a' || s[i] > 'z') && (s[i] < 'A' || s[i] > 'Z') && (s[i] < '0' || s[i] > '9')) {
  248.                 prov = 1;
  249.             }
  250.             if (s[i] >= '0' && s[i] <= '9') {
  251.                 kolchi++;
  252.             }
  253.             else
  254.                 if (s[i] >= 'a' && s[i] <= 'z') {
  255.                     mal = 1;
  256.                 }
  257.                 else
  258.                     if (s[i] >= 'A' && s[i] <= 'Z') {
  259.                         bol = 1;
  260.                     }
  261.         }
  262.         if (prov == 0) { return s; }
  263.         else {
  264.             system("cls");
  265.             cout << "Логин: " << login << endl;
  266.             cout << "Пароль должен состоять из цифр и латинской буквы." << endl;
  267.             cout << "Введите пароль: ";
  268.         }
  269.     }
  270. }
  271.  
  272. int fillFileAccount(Account* Acc, int n) {
  273.     fstream clr_file("registr.txt", ios::out);
  274.     clr_file.close();
  275.     ofstream fo;
  276.     fo.open("registr.txt", ios::out);
  277.     for (int i = 0; i < n; i++) {
  278.         fo << i << endl;
  279.         fo << Acc[i].log << endl;
  280.         fo << Acc[i].pas << endl;
  281.         fo << Acc[i].prava << endl;
  282.     }
  283.     fo << n << endl;
  284.     fo << Acc[n].log << endl;
  285.     fo << Acc[n].pas << endl;
  286.     fo << Acc[n].prava << endl;
  287.     fo << n + 1 << endl;
  288.     fo.close();
  289.     return 0;
  290. }
  291.  
  292. string proverkaLogin(Account* Acc, int n1) {
  293.     cout << "Введите логин: ";
  294.     string s;
  295.     while (true) {
  296.         int prov = 0;
  297.  
  298.         getline(cin, s);
  299.         for (int i = 0; i < n1; i++) {
  300.             if (s == Acc[i].log) prov = 3;
  301.         }
  302.  
  303.         if (prov == 0) {
  304.             system("cls");
  305.             cout << "Такого логина не существует." << endl;
  306.             cout << "Введите логин: ";
  307.         }
  308.         else
  309.             if (prov == 3) { return s; }
  310.     }
  311. }
  312.  
  313. string proverkaParolya(Account* Acc, int n1, string login) {
  314.     system("cls");
  315.     cout << "Логин: " << login << endl;
  316.     cout << "Введите ваш пароль: ";
  317.     string s;
  318.     int popitki = 4;
  319.     while (true) {
  320.         int check1 = 0;
  321.         s = enterPassword();
  322.         for (int i = 0; i < n1; i++) {
  323.             if (Acc[i].log == login && Acc[i].pas == s) {
  324.                 check1 = 1;
  325.                 break;
  326.             }
  327.         }
  328.         if (check1 == 1) { system("cls"); return s; }
  329.         else {
  330.             system("cls");
  331.             cout << "Логин: " << login << endl;
  332.             cout << "Вы ввели не верный пароль. Повторите попытку. У вас еще " << popitki - 1 << " попытки(а)" << endl;
  333.             cout << "Введите пароль: ";
  334.         }
  335.         popitki--;
  336.         s = "-666";
  337.         if (popitki == 0) return s;
  338.     }
  339. }
  340.  
  341. string enterPassword() {
  342.     string s;
  343.     while (true) {
  344.         int c;
  345.         char cc;
  346.         c = _getch();
  347.         if (c == 224) {
  348.             c = _getch();
  349.         }
  350.         else
  351.             if (c == 8) {
  352.                 if (s.length() != 0) {
  353.                     cout << '\b' << " " << '\b';
  354.                     s.erase(s.length() - 1);
  355.                 }
  356.             }
  357.             else
  358.                 if (c == 13) break;
  359.                 else
  360.                     if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) {
  361.                         cc = (char)c;
  362.                         s = s + cc;
  363.                         cout << "*";
  364.                     }
  365.     }
  366.     return s;
  367. }
  368.  
  369. int menuAdmin(Account* Acc, int n, string login) {
  370.     while (true) {
  371.         int mn = vivodMenuAdmin(login);
  372.         if (mn == 3) {
  373.             return 0;
  374.         }
  375.         else
  376.             if (mn == 0) {
  377.                 menuUserAdmin(Acc, n);
  378.             }
  379.             else
  380.                 if (mn == 1) {
  381.                     dataChangeMenu();
  382.                 }
  383.                 else {
  384.                     menuUser("");
  385.                 }
  386.     }
  387. }
  388.  
  389. int vivodMenuAdmin(string login) {
  390.     int kol = 0, key = 0;
  391.     while (true) {
  392.         cout << "Стрелочками ВВЕРХ и ВНИЗ выберите меню" << endl;
  393.         kol = (kol + 4) % 4;
  394.         cout << "Здраствуйте админ.: " << login << "." << endl;
  395.         if (kol == 0) { cout << " -- Меню редактирования учетных записей" << endl; }
  396.         else cout << " Меню редактирования учетных записей" << endl;
  397.  
  398.         if (kol == 1) { cout << " -- Меню редактирования информации" << endl; }
  399.         else cout << " Меню редактирования информации" << endl;
  400.  
  401.         if (kol == 2) { cout << " -- Меню обработки информации" << endl; }
  402.         else { cout << " Меню обработки информации" << endl; }
  403.  
  404.         if (kol == 3) { cout << " -- Выйти в главное меню" << endl; }
  405.         else { cout << " Выйти в главное меню" << endl; }
  406.  
  407.         key = _getch();
  408.         if (key == 224) {
  409.             key = _getch();
  410.             if (key == 72) kol--;
  411.             if (key == 80) kol++;
  412.         }
  413.         if (key == 13) { system("cls"); return kol; }
  414.         system("cls");
  415.     }
  416. }
  417.  
  418. void menuUserAdmin(Account* Acc, int n) {
  419.     int key_acc;
  420.     while (true) {
  421.         key_acc = vivodMenuAccounta();
  422.         if (key_acc == 4) {
  423.             break;
  424.         }
  425.         else
  426.             if (key_acc == 0) {
  427.                 system("cls");
  428.                 vivodInfUser(Acc, n);
  429.             }
  430.             else
  431.                 if (key_acc == 1) {
  432.                     system("cls");
  433.                     Account* t = new Account[n + 1];
  434.                     copy(Acc, Acc + n, t);
  435.                     delete[]Acc;
  436.                     Acc = t;
  437.                     t = NULL;
  438.                     Acc[n].log = proverkaLogina(Acc, n);
  439.                     Acc[n].pas = proverkaRegisterPass(Acc[n].log);
  440.                     Acc[n].prava = proverkaPravPolzovatelya();
  441.                     n = n + 1;
  442.                     system("cls");
  443.                 }
  444.                 else
  445.                     if (key_acc == 2) {
  446.                         system("cls");
  447.                         int vibr = editAccount(Acc, n);
  448.                         if (vibr == n) continue;
  449.                         int vibr1 = viborEditAccount(Acc, vibr);
  450.                         if (vibr1 == 0) Acc[vibr].log = proverkaLogina(Acc, n);
  451.                         else
  452.                             if (vibr1 == 1) Acc[vibr].pas = proverkaRegisterPass(Acc[vibr].log);
  453.                             else Acc[vibr].prava = proverkaPravPolzovatelya();
  454.                         system("cls");
  455.                     }
  456.                     else
  457.                         if (key_acc == 3) {
  458.                             int vibr = editAccount(Acc, n);
  459.                             if (vibr == n) continue;
  460.                             cout << "Аккаунт " << Acc[vibr].log << " удалён!!!" << endl;
  461.                             for (int i = vibr; i < n - 1; i++) {
  462.                                 Acc[i] = Acc[i + 1];
  463.                             }
  464.                             n--;
  465.                             system("pause");
  466.                             system("cls");
  467.                         }
  468.     }
  469.     fillFileAccount(Acc, n - 1);
  470. }
  471.  
  472. int vivodMenuAccounta() {
  473.     int kol = 0, key = 0;
  474.     while (true) {
  475.         cout << "Стрелочками ВВЕРХ и ВНИЗ выберите меню" << endl;
  476.         kol = (kol + 5) % 5;
  477.         if (kol == 0) { cout << " -- Просмотр учетных записей" << endl; }
  478.         else cout << " Просмотр учетных записей" << endl;
  479.  
  480.         if (kol == 1) { cout << " -- Добавление учетной записи" << endl; }
  481.         else cout << " Добавление учетной записи" << endl;
  482.  
  483.         if (kol == 2) { cout << " -- Редактирование учетных записей" << endl; }
  484.         else { cout << " Редактирование учетных записей" << endl; }
  485.  
  486.         if (kol == 3) { cout << " -- Удаление учетной записи" << endl; }
  487.         else { cout << " Удаление учетной записи" << endl; }
  488.  
  489.         if (kol == 4) { cout << " -- Выйти в меню администратора" << endl; }
  490.         else { cout << " Выйти в меню администратора" << endl; }
  491.  
  492.         key = _getch();
  493.         if (key == 224) {
  494.             key = _getch();
  495.             if (key == 72) kol--;
  496.             if (key == 80) kol++;
  497.         }
  498.         if (key == 13) { system("cls"); return kol; }
  499.         system("cls");
  500.     }
  501. }
  502.  
  503. int vivodInfUser(Account* Acc, int n) {
  504.     for (int i = 0; i < n; i++) {
  505.         cout << setw(24) << "     Пользователь №" << i + 1 << endl;
  506.         cout << " Логин: " << Acc[i].log << endl;
  507.         cout << " Пароль: " << Acc[i].pas << endl;
  508.         if (Acc[i].prava == 1)
  509.             cout << " Роль: Администратор" << endl;
  510.         else
  511.             cout << " Роль: Пользователь" << endl;
  512.     }
  513.     system("pause");
  514.     system("cls");
  515.     return 0;
  516. }
  517.  
  518. int proverkaPravPolzovatelya() {
  519.     string s;
  520.     while (true) {
  521.         system("cls");
  522.         cout << "Введите 0 - если у пользоветля будут права администратора или 1 - если у пользователя будут обычные права: ";
  523.         getline(cin, s);
  524.         system("cls");
  525.         if (s == "1") return 1;
  526.         else
  527.             if (s == "0") return 0;
  528.     }
  529. }
  530.  
  531. int editAccount(Account* Acc, int n) {
  532.     int kol = 1, key;
  533.     while (true) {
  534.         cout << "Стрелочками ВВЕРХ и ВНИЗ выберите аккаунт " << endl;
  535.         kol = (kol + (n + 1)) % (n + 1);
  536.         for (int i = 1; i < n; i++) {
  537.             if (i == kol) { cout << " -- " << i << " - " << Acc[i].log << endl; }
  538.             else cout << " " << i << " - " << Acc[i].log << endl;
  539.         }
  540.         if (kol == n) { cout << " -- Выйти с выбора пользовтеля" << endl; }
  541.         else cout << " Выйти с выбора пользовтеля" << endl;
  542.         key = _getch();
  543.         if (key == 224) {
  544.             key = _getch();
  545.             if (key == 72) { kol--; if (kol == 0) kol = n; }
  546.             if (key == 80) { kol++; if (kol == n + 1) kol = 1; }
  547.         }
  548.         if (key == 13) { system("cls"); return kol; }
  549.         system("cls");
  550.     }
  551. }
  552.  
  553. int viborEditAccount(Account* Acc, int vibr) {
  554.     int kol = 0, key = 0;
  555.     while (true) {
  556.         cout << "Стрелочками ВВЕРХ и ВНИЗ выбериет меню" << endl;
  557.         kol = (kol + 3) % 3;
  558.         if (kol == 0) { cout << " -- Изменить логин: " << Acc[vibr].log << endl; }
  559.         else cout << " Изменить логин: " << Acc[vibr].log << endl;
  560.  
  561.         if (kol == 1) { cout << " -- Изменить пароль: " << Acc[vibr].pas << endl; }
  562.         else cout << " Изменить пароль: " << Acc[vibr].pas << endl;
  563.  
  564.         if (kol == 2) { cout << " -- Изменить права: " << Acc[vibr].prava << endl; }
  565.         else { cout << " Изменить права: " << Acc[vibr].prava << endl; }
  566.  
  567.         key = _getch();
  568.         if (key == 224) {
  569.             key = _getch();
  570.             if (key == 72) kol--;
  571.             if (key == 80) kol++;
  572.         }
  573.         if (key == 13) { system("cls"); return kol; }
  574.         system("cls");
  575.     }
  576. }
  577.  
  578. void dataChangeMenu() {
  579.     ifstream fin;
  580.     fin.open("Project.txt", ios::in);
  581.     fin.seekg(-3, ios::end);
  582.     int n = 0;
  583.     fin >> n;
  584.     fin.close();
  585.     Project* Proj = new Project[n + 1];
  586.     if (n != 0)
  587.         fillProj(Proj, n);
  588.     while (true) {
  589.         int vibr = vivodMenuEdita();
  590.         if (vibr == 4) break;
  591.         else
  592.             if (vibr == 0) {
  593.                 if (n == 0) { cout << "Проектов в базе данных нет!" << endl; system("pause"); system("cls"); }
  594.                 else {
  595.                     vivodProj(Proj, n);
  596.                 }
  597.             }
  598.             else
  599.                 if (vibr == 1) {
  600.                     Project* tt = new Project[n + 2];
  601.                     copy(Proj, Proj + n, tt);
  602.                     delete[]Proj;
  603.                     Proj = tt;
  604.                     tt = NULL;
  605.                     addProject(Proj, n);
  606.                     n++;
  607.                 }                                                                        
  608.                 else
  609.                     if (vibr == 2) {
  610.                         int vibor = 0;
  611.                         int viborR = 0;
  612.                         while (true) {
  613.                             vibor = editProj(Proj, n);
  614.                             if (vibor == n) break;
  615.                             while (true) {
  616.                                 viborR = viborEdita(Proj, vibor);
  617.                                 if (viborR == 5) break;
  618.                                 if (viborR == 0) { cout << "Введите наименование проекта: "; Proj[vibor].name_project = enterWords();  system("cls"); }
  619.                                 else
  620.                                     if (viborR == 1) { Proj[vibor].vid_rab = proverkaVidaRabot(); system("cls"); }
  621.                                     else
  622.                                         if (viborR == 2) { Proj[vibor].FIO = enterFIO(); system("cls"); }
  623.                                         else
  624.                                             if (viborR == 3) {
  625.                                                 cout << "Введите количество часов: ";
  626.                                                 Proj[vibor].kolvo_chas = proverkaPricePerHour();
  627.                                                 system("cls");
  628.                                             }
  629.                                             else
  630.                                                 if (viborR == 4) {
  631.                                                     cout << "Введите стоимость часа: ";
  632.                                                     Proj[vibor].stoimost_chas = proverkaPricePerHour();
  633.                                                     system("cls");
  634.                                                 }
  635.                             }
  636.                         }
  637.                     }
  638.                     else
  639.                         if (vibr == 3) {
  640.                             int udal = editProj(Proj, n);
  641.                             if (udal == n) continue;
  642.                             else {
  643.                                 for (int i = udal; i < n - 1; i++) {
  644.                                     Proj[i] = Proj[i + 1];
  645.                                 }
  646.                                 n--;
  647.                             }
  648.                         }
  649.                         else break;
  650.     }
  651.     if (n != 0) fillFileProj(Proj, n);
  652. }
  653.  
  654. void fillProj(Project* Proj, int n) {
  655.     ifstream fin;
  656.     fin.open("Project.txt", ios::in);
  657.     string s;
  658.     getline(fin, s);
  659.     for (int i = 0; i < n; i++) {
  660.         getline(fin, Proj[i].name_project);
  661.         getline(fin, Proj[i].vid_rab);
  662.         getline(fin, Proj[i].FIO);
  663.         getline(fin, Proj[i].kolvo_chas);
  664.         getline(fin, Proj[i].stoimost_chas);
  665.         getline(fin, s);
  666.     }
  667.     fin.close();
  668. }
  669.  
  670. int vivodMenuEdita() {
  671.     int kol = 0, key = 0;
  672.     while (true) {
  673.         cout << "Стрелочками ВВЕРХ и ВНИЗ выберите меню" << endl;
  674.         kol = (kol + 5) % 5;
  675.         if (kol == 0) { cout << " -- Просмотр списка проектов" << endl; }
  676.         else cout << " Просмотр списка проектов" << endl;
  677.  
  678.         if (kol == 1) { cout << " -- Добавление проектов" << endl; }
  679.         else cout << " Добавление проектов" << endl;
  680.  
  681.         if (kol == 2) { cout << " -- Редактирование проектов" << endl; }
  682.         else { cout << " Редактирование проектов" << endl; }
  683.  
  684.         if (kol == 3) { cout << " -- Удаление проектов" << endl; }
  685.         else { cout << " Удаление проектов" << endl; }
  686.  
  687.         if (kol == 4) { cout << " -- Выйти в меню администратора" << endl; }
  688.         else { cout << " Выйти в меню администратора" << endl; }
  689.  
  690.         key = _getch();
  691.         if (key == 224) {
  692.             key = _getch();
  693.             if (key == 72) kol--;
  694.             if (key == 80) kol++;
  695.         }
  696.         if (key == 13) { system("cls"); return kol; }
  697.         system("cls");
  698.     }
  699. }
  700.  
  701. void vivodProj(Project* Proj, int n) {//ask
  702.     for (int i = 0; i < n; i++) {
  703.         cout << "     Проект №" << i + 1 << endl;
  704.         cout << " Наименование проекта: " << Proj[i].name_project << endl;
  705.         cout << " Вид работ: " << Proj[i].vid_rab << endl;
  706.         cout << " Ф.И.О: " << Proj[i].FIO << endl;
  707.         cout << " Количество часов: " << Proj[i].kolvo_chas << endl;
  708.         cout << " Стоимость часа: " << Proj[i].stoimost_chas << endl;
  709.         cout << endl;
  710.         cout << endl;
  711.     }
  712.     system("pause");
  713.     system("cls");
  714. }
  715.  
  716. int addProject(Project* Proj, int n) {
  717.     cout << "Введите наименование проекта: ";
  718.     Proj[n].name_project = enterWords();
  719.     system("cls");
  720.     Proj[n].vid_rab = proverkaVidaRabot();
  721.     system("cls");
  722.     Proj[n].FIO = enterFIO();
  723.     system("cls");
  724.     cout << "Введите количество часов: ";
  725.     Proj[n].kolvo_chas = proverkaPricePerHour();
  726.     system("cls");
  727.     cout << "Введите стоимость часа: ";
  728.     Proj[n].stoimost_chas = proverkaPricePerHour();
  729.     system("cls");
  730.     return 0;
  731. }
  732.  
  733. string enterFIO() {
  734.     cout << "Введите имя: ";
  735.     string name = enterWords();
  736.     cout << endl;
  737.     cout << "Введите фамилию: ";
  738.     string fam = enterWords();
  739.     cout << endl;
  740.     cout << "Введите отчество: ";
  741.     string otch = enterWords();
  742.     system("cls");
  743.     return fam + " " + name + " " + otch;
  744. }
  745.  
  746. string enterWords() {
  747.     string s;
  748.     while (true) {
  749.         int c;
  750.         char cc;
  751.         c = _getch();
  752.         if (c == 224) {
  753.             c = _getch();
  754.         }
  755.         else
  756.             //backspace  
  757.             if (c == 8) {
  758.                 if (s.length() != 0) {
  759.                     cout << '\b' << " " << '\b';
  760.                     s.erase(s.length() - 1);
  761.                 }
  762.             }
  763.             else
  764.                 //enter
  765.                 if (c == 13) {
  766.                     break;
  767.                 }
  768.                 else {
  769.                     cc = (char)c;
  770.                     if ((cc >= 'a' && cc <= 'z') || (cc >= 'A' && cc <= 'Z')) {
  771.                         s = s + cc;
  772.                         cout << cc;
  773.                     }
  774.                 }
  775.     }
  776.     return s;
  777. }
  778.  
  779. string proverkaVidaRabot() {
  780.     int kol = 0, key = 0;
  781.     string s;
  782.     while (true) {
  783.         cout << "Стрелочками ВВЕРХ и ВНИЗ выберите вид работы: " << endl;
  784.         kol = (kol + 4) % 4;
  785.  
  786.         if (kol == 0) { cout << " -- Работа над требованиями" << endl; s = "Работа над требованиями"; }
  787.         else cout << " Работа над требованиями" << endl;
  788.  
  789.         if (kol == 1) { cout << " -- Разработка архитектуры" << endl; s = "Разработка архитектуры"; }
  790.         else cout << " Разработка архитектуры" << endl;
  791.  
  792.         if (kol == 2) { cout << " -- Реализация" << endl; s = "Реализация"; }
  793.         else cout << " Реализация" << endl;
  794.  
  795.         if (kol == 3) { cout << " -- Тестирование" << endl; s = "Тестирование"; }
  796.         else { cout << " Тестирование" << endl; }
  797.  
  798.         key = _getch();
  799.         if (key == 224) {
  800.             key = _getch();                 //стрелки
  801.             if (key == 72) kol--;
  802.             if (key == 80) kol++;
  803.         }//enter
  804.         if (key == 13) { system("cls"); return s; }
  805.         system("cls");
  806.     }
  807. }
  808.  
  809. string proverkaPricePerHour() {
  810.     string s;
  811.     while (true) {
  812.         int c;
  813.         char cc;
  814.         c = _getch();
  815.         if (c == 224) {
  816.             c = _getch();
  817.         }
  818.         else
  819.             if (c == 8) {
  820.                 if (s.length() != 0) {
  821.                     cout << '\b' << " " << '\b';
  822.                     s.erase(s.length() - 1);
  823.                 }
  824.             }
  825.             else
  826.                 if (c == 13) break;
  827.                 else
  828.                     if (s.length() == 8) continue;
  829.                     else
  830.                         if (c >= '0' && c <= '9') {
  831.                             cc = (char)c;
  832.                             s = s + cc;
  833.                             cout << cc;
  834.                         }
  835.     }
  836.     return s;
  837. }
  838.  
  839. int editProj(Project* Proj, int n) {
  840.     int kol = 0, key;
  841.     while (true) {
  842.         cout << "Стрелочками ВВЕРХ и ВНИЗ выберите проект " << endl;
  843.         kol = (kol + (n + 1)) % (n + 1);
  844.         for (int i = 0; i < n; i++) {
  845.             if (i == kol) { cout << " -- " << i << " - " << Proj[i].name_project << " " << Proj[i].vid_rab << endl; }
  846.             else cout << " " << i << " - " << Proj[i].name_project << " " << Proj[i].vid_rab << endl;
  847.         }
  848.         if (kol == n) { cout << " -- Выйти с выбора проекта" << endl; }
  849.         else cout << " Выйти с выбора проекта" << endl;
  850.         key = _getch();
  851.         if (key == 224) {
  852.             key = _getch();
  853.             if (key == 72) kol--;
  854.             if (key == 80) kol++;
  855.         }
  856.         if (key == 13) { system("cls"); return kol; }
  857.         system("cls");
  858.     }
  859. }
  860.  
  861. int viborEdita(Project* Proj, int vibr) {
  862.     int kol = 0, key = 0;
  863.     while (true) {
  864.         cout << "Стрелочками ВВЕРХ и ВНИЗ выбериет пункт редактирования" << endl;
  865.         kol = (kol + 6) % 6;
  866.         if (kol == 0) { cout << " -- Изменить наименование проекта: " << Proj[vibr].name_project << endl; }
  867.         else cout << " Изменить наименование проекта: " << Proj[vibr].name_project << endl;
  868.  
  869.         if (kol == 1) { cout << " -- Изменить вид работы: " << Proj[vibr].vid_rab << endl; }
  870.         else cout << " Изменить вид работы: " << Proj[vibr].vid_rab << endl;
  871.  
  872.         if (kol == 2) { cout << " -- Изменить Ф.И.О: " << Proj[vibr].FIO << endl; }
  873.         else { cout << " Изменить Ф.И.О: " << Proj[vibr].FIO << endl; }
  874.  
  875.         if (kol == 3) { cout << " -- Изменить кол-во часов: " << Proj[vibr].kolvo_chas << endl; }
  876.         else { cout << " Изменить кол-во часов: " << Proj[vibr].kolvo_chas << endl; }
  877.  
  878.         if (kol == 4) { cout << " -- Изменить стоимость часа: " << Proj[vibr].stoimost_chas << endl; }
  879.         else { cout << " Изменить стоимость часа: " << Proj[vibr].stoimost_chas << endl; }
  880.  
  881.         if (kol == 5) { cout << " -- Выйти к выбору проекта." << endl; }
  882.         else { cout << " Выйти к выбору проекта." << endl; }
  883.  
  884.  
  885.         key = _getch();
  886.         if (key == 224) {
  887.             key = _getch();
  888.             if (key == 72) kol--;
  889.             if (key == 80) kol++;
  890.         }
  891.         if (key == 13) { system("cls"); return kol; }
  892.         system("cls");
  893.     }
  894. }
  895.  
  896. void fillFileProj(Project* Proj, int n) {
  897.     fstream clear_file("Project.txt", ios::out);
  898.     clear_file.close();
  899.     ofstream fout;
  900.     fout.open("Project.txt", ios::out);
  901.     for (int i = 0; i < n; i++) {
  902.         fout << i << endl;
  903.         fout << Proj[i].name_project << endl;
  904.         fout << Proj[i].vid_rab << endl;
  905.         fout << Proj[i].FIO << endl;
  906.         fout << Proj[i].kolvo_chas << endl;
  907.         fout << Proj[i].stoimost_chas << endl;
  908.     }
  909.     fout << n << endl;
  910.     fout.close();
  911. }
  912.  
  913. void menuUser(string login) {
  914.     ifstream fin;
  915.     fin.open("Project.txt", ios::in);
  916.     fin.seekg(-3, ios::end);
  917.     int n = 0;
  918.     fin >> n;
  919.     fin.close();
  920.     Project* Proj = new Project[n + 1];
  921.     if (n != 0)
  922.         fillProj(Proj, n);
  923.     else {
  924.         cout << "Проектов в базе, нет" << endl;
  925.         system("pause");
  926.         system("cls");
  927.         return;
  928.     }
  929.     while (true) {
  930.         int menu = vivodMenuUser(login);
  931.         if (menu == 0) {
  932.             vivodProj(Proj, n);
  933.         }
  934.         else
  935.             if (menu == 1) {
  936.                 individualEx(Proj, n);
  937.             }
  938.             else
  939.                 if (menu == 2) {
  940.                     int mn = vivodSearchMenu();
  941.                     searchMenu(Proj, mn, n);
  942.                 }
  943.                 else
  944.                     if (menu == 3) {
  945.                         int mn = vivodSortMenu();
  946.                         menuSort(Proj, mn, n);
  947.                     }
  948.                     else {
  949.                         break;
  950.                     }
  951.     }
  952.     fillFileProj(Proj, n);
  953. }
  954.  
  955. int vivodMenuUser(string s) {
  956.     int kol = 0, key = 0;
  957.     while (true) {
  958.         cout << "Стрелочками ВВЕРХ и ВНИЗ выберите пункт меню" << endl;
  959.         kol = (kol + 5) % 5;
  960.  
  961.         if (s.length() != 0) {
  962.             cout << "Здраствуйте пользователь, " << s << "!!!" << endl;
  963.         }
  964.  
  965.         if (kol == 0) { cout << " -- Просмотр информации о проектах" << endl; }
  966.         else cout << " Просмотр информации о проектах" << endl;
  967.  
  968.         if (kol == 1) { cout << " -- Индивидуальное задание" << endl; }
  969.         else cout << " Индивидуальное задание" << endl;
  970.  
  971.         if (kol == 2) { cout << " -- Поиск" << endl; }
  972.         else cout << " Поиск" << endl;
  973.  
  974.         if (kol == 3) { cout << " -- Сортировка" << endl; }
  975.         else { cout << " Сортировка" << endl; }
  976.  
  977.         if (kol == 4) { cout << " -- Выйти в меню" << endl; }
  978.         else { cout << " Выйти в меню" << endl; }
  979.  
  980.         key = _getch();
  981.         if (key == 224) {
  982.             key = _getch();
  983.             if (key == 72) kol--;
  984.             if (key == 80) kol++;
  985.         }
  986.         if (key == 13) { system("cls"); return kol; }
  987.         system("cls");
  988.     }
  989. }
  990.  
  991. int vivodSearchMenu() {
  992.     int kol = 0, key = 0;
  993.     while (true) {
  994.         cout << "Стрелочками ВВЕРХ и ВНИЗ выберите пункт меню" << endl;
  995.         kol = (kol + 4) % 4;
  996.  
  997.         if (kol == 0) { cout << " -- Поиск по наименованию проекта" << endl; }
  998.         else cout << " Поиск по наименованию проекта" << endl;
  999.  
  1000.         if (kol == 1) { cout << " -- Поиск по количеству часов" << endl; }
  1001.         else cout << " Поиск по количеству часов" << endl;
  1002.  
  1003.         if (kol == 2) { cout << " -- Поиск по стоимости за час" << endl; }
  1004.         else cout << " Поиск по стоимости за час" << endl;
  1005.  
  1006.         if (kol == 3) { cout << " -- Выход в меню обработки" << endl; }
  1007.         else cout << " Выход в меню обработки" << endl;
  1008.  
  1009.  
  1010.         key = _getch();
  1011.         if (key == 224) {
  1012.             key = _getch();
  1013.             if (key == 72) kol--;
  1014.             if (key == 80) kol++;
  1015.         }
  1016.         if (key == 13) { system("cls"); return kol; }
  1017.         system("cls");
  1018.     }
  1019. }
  1020.  
  1021. void searchMenu(Project* Proj, int mn, int n) {
  1022.     if (mn == 0) {
  1023.         cout << "Введите наименование проекта который нужно искать: ";
  1024.         string nproj = enterWords();
  1025.         system("cls");
  1026.         int pop = 0;
  1027.         cout << endl;
  1028.         for (int i = 0; i < n; i++)
  1029.             if (Proj[i].name_project.length() >= nproj.length()) {
  1030.                 int kol = -666;
  1031.                 for (int j = 0; j < nproj.length(); j++)
  1032.                     if (nproj[j] != tolower(Proj[i].name_project[j]) && nproj[j] != toupper(Proj[i].name_project[j])) kol = 0;
  1033.                 if (kol == -666) {
  1034.                     vivodProj1(Proj, i);
  1035.                     pop++;
  1036.                 }
  1037.             }
  1038.         if (pop == 0) {
  1039.             cout << "Проектов с таким наименование, нет." << endl;
  1040.         }
  1041.         system("pause");
  1042.         system("cls");
  1043.     }
  1044.     else
  1045.         if (mn == 1) {
  1046.             cout << "Введите количество часов: ";
  1047.             string kolchas = proverkaPricePerHour();
  1048.             system("cls");
  1049.             int pop = 0;
  1050.             for (int i = 0; i < n; i++)
  1051.                 if (kolchas == Proj[i].kolvo_chas) {
  1052.                     vivodProj1(Proj, i);
  1053.                     pop++;
  1054.                 }
  1055.             if (pop == 0) {
  1056.                 cout << "Проектов с таким количеством часов, нет." << endl;
  1057.             }
  1058.             system("pause");
  1059.             system("cls");
  1060.         }
  1061.         else
  1062.             if (mn == 2) {
  1063.                 cout << "Введите стоимость за час: ";
  1064.                 string stchas = proverkaPricePerHour();
  1065.                 int pop = 0;
  1066.                 for (int i = 0; i < n; i++)
  1067.                     if (stchas == Proj[i].stoimost_chas) {
  1068.                         vivodProj1(Proj, i);
  1069.                         pop++;
  1070.                     }
  1071.                 if (pop == 0) cout << "Проектов с такой стоимостью за час, нет!!!" << endl;
  1072.                 system("pause");
  1073.                 system("cls");
  1074.             }
  1075. } //уточнить
  1076.  
  1077. void vivodProj1(Project* Proj, int i) {
  1078.     cout << "     Проект №" << i + 1 << endl;
  1079.     cout << " Наименование проекта: " << Proj[i].name_project << endl;
  1080.     cout << " Вид работ: " << Proj[i].vid_rab << endl;
  1081.     cout << " Ф.И.О: " << Proj[i].FIO << endl;
  1082.     cout << " Количество часов: " << Proj[i].kolvo_chas << endl;
  1083.     cout << " Стоимость часа: " << Proj[i].stoimost_chas << endl;
  1084.     cout << endl;
  1085.     cout << endl;
  1086. }
  1087.  
  1088. int vivodSortMenu() {
  1089.     int kol = 0, key = 0;
  1090.     while (true) {
  1091.         cout << "Стрелочками ВВЕРХ и ВНИЗ выберите пункт меню" << endl;
  1092.         kol = (kol + 4) % 4;
  1093.  
  1094.         if (kol == 0) { cout << " -- Сортировка по возрастанию стоимости за час" << endl; }
  1095.         else cout << " Сортировка по возрастанию стоимости за час" << endl;
  1096.  
  1097.         if (kol == 1) { cout << " -- Сортировка по убыванию стоимости за час" << endl; }
  1098.         else cout << " Сортировка по убыванию стоимости за час" << endl;
  1099.  
  1100.         if (kol == 2) { cout << " -- Сортировка по возростанию кол-во часов" << endl; }
  1101.         else cout << " Сортировка по возростанию кол-во часов" << endl;
  1102.  
  1103.         if (kol == 3) { cout << " -- Сортировка по убыванию кол-во часов" << endl; }
  1104.         else { cout << " Сортировка по убыванию кол-во часов" << endl; }
  1105.  
  1106.         if (kol == 4) { cout << " -- Выйти в меню обработки" << endl; }
  1107.         else { cout << " Выйти в меню обработки" << endl; }
  1108.  
  1109.         key = _getch();
  1110.         if (key == 224) {
  1111.             key = _getch();
  1112.             if (key == 72) kol--;
  1113.             if (key == 80) kol++;
  1114.         }
  1115.         if (key == 13) { system("cls"); return kol; }
  1116.         system("cls");
  1117.     }
  1118. }
  1119.  
  1120. void menuSort(Project* Proj, int mn, int n) {
  1121.     if (mn == 0) {
  1122.         for (int i = 0; i < n; i++)
  1123.             for (int j = 0; j < n - 1; j++) {
  1124.                 int s1, s2;
  1125.                 s1 = stoi(Proj[j].stoimost_chas);
  1126.                 s2 = stoi(Proj[j + 1].stoimost_chas);
  1127.                 if (s1 > s2) {
  1128.                     Project* Mas = new Project[1];
  1129.                     Mas[0] = Proj[j];
  1130.                     Proj[j] = Proj[j + 1];
  1131.                     Proj[j + 1] = Mas[0];
  1132.                 }
  1133.             }
  1134.         cout << "Проекты отсортированы по возрастанию стоимости за час." << endl;
  1135.         system("pause");
  1136.         system("cls");
  1137.     }
  1138.     else
  1139.         if (mn == 1) {
  1140.             for (int i = 0; i < n; i++)
  1141.                 for (int j = 0; j < n - 1; j++) {
  1142.                     int s1, s2;
  1143.                     s1 = stoi(Proj[j].stoimost_chas);
  1144.                     s2 = stoi(Proj[j + 1].stoimost_chas);
  1145.                     if (s1 < s2) {
  1146.                         Project* Mas = new Project[1];
  1147.                         Mas[0] = Proj[j];
  1148.                         Proj[j] = Proj[j + 1];
  1149.                         Proj[j + 1] = Mas[0];
  1150.                     }
  1151.                 }
  1152.             cout << "Проекты отсортированы по убыванию стоимости за час." << endl;
  1153.             system("pause");
  1154.             system("cls");
  1155.         }
  1156.     if (mn == 2) {
  1157.         for (int i = 0; i < n; i++)
  1158.             for (int j = 0; j < n - 1; j++) {
  1159.                 int s1, s2;
  1160.                 s1 = stoi(Proj[j].kolvo_chas);
  1161.                 s2 = stoi(Proj[j + 1].kolvo_chas);
  1162.                 if (s1 > s2) {
  1163.                     Project* Mas = new Project[1];
  1164.                     Mas[0] = Proj[j];
  1165.                     Proj[j] = Proj[j + 1];
  1166.                     Proj[j + 1] = Mas[0];
  1167.                 }
  1168.             }
  1169.         cout << "Проекты отсортированы по возрастанию кол-во часов." << endl;
  1170.         system("pause");
  1171.         system("cls");
  1172.     }
  1173.     if (mn == 3) {
  1174.         for (int i = 0; i < n; i++)
  1175.             for (int j = 0; j < n - 1; j++) {
  1176.                 int s1, s2;
  1177.                 s1 = stoi(Proj[j].kolvo_chas);
  1178.                 s2 = stoi(Proj[j + 1].kolvo_chas);
  1179.                 if (s1 < s2) {
  1180.                     Project* Mas = new Project[1];
  1181.                     Mas[0] = Proj[j];
  1182.                     Proj[j] = Proj[j + 1];
  1183.                     Proj[j + 1] = Mas[0];
  1184.                 }
  1185.             }
  1186.         cout << "Проекты отсортированы по убыванию кол-во часов." << endl;
  1187.         system("pause");
  1188.         system("cls");
  1189.     }
  1190. }
  1191.  
  1192. void individualEx(Project* Proj, int n) {
  1193.     IndvZad* Mas = new IndvZad[n];
  1194.     int kol = 0;
  1195.     for (int i = 0; i < n; i++) {
  1196.         int prov = 0, tot = 0, tot1 = 0;
  1197.         for (int j = 0; j < kol; j++)
  1198.             if (prov == 0) {
  1199.                 if (Proj[i].name_project.length() == Mas[j].name_proj.length()) {
  1200.                     for (int k = 0; k < Proj[i].name_project.length(); k++) {
  1201.                         if (tolower(Proj[i].name_project[k]) == tolower(Mas[j].name_proj[k])) {
  1202.                             prov = 1;
  1203.                             tot = j;
  1204.                             break;
  1205.                         }
  1206.                     }
  1207.                 }
  1208.             }
  1209.             else break;
  1210.  
  1211.         if (prov == 0) {
  1212.             Mas[kol].name_proj = Proj[i].name_project;
  1213.             Mas[kol].kolvo_sotrud = 1;
  1214.             Mas[kol].stoimost_proekta = stoi(Proj[i].stoimost_chas) * stoi(Proj[i].kolvo_chas);
  1215.             if (Proj[i].vid_rab == "Работа над требованиями") { Mas[kol].perechen_rabot[0] = 1;  Mas[kol].perechen_rabot_st[0] = (stoi(Proj[i].stoimost_chas) * stoi(Proj[i].kolvo_chas)); }
  1216.             else
  1217.                 if (Proj[i].vid_rab == "Разработка архитектуры") { Mas[kol].perechen_rabot[1] = 1; Mas[kol].perechen_rabot_st[1] = (stoi(Proj[i].stoimost_chas) * stoi(Proj[i].kolvo_chas)); }
  1218.                 else
  1219.                     if (Proj[i].vid_rab == "Реализация") { Mas[kol].perechen_rabot[2] = 1; Mas[kol].perechen_rabot_st[2] = (stoi(Proj[i].stoimost_chas) * stoi(Proj[i].kolvo_chas)); }
  1220.                     else
  1221.                         if (Proj[i].vid_rab == "Тестирование") { Mas[kol].perechen_rabot[3] = 1; Mas[kol].perechen_rabot_st[3] = (stoi(Proj[i].stoimost_chas) * stoi(Proj[i].kolvo_chas)); }
  1222.             kol++;
  1223.         }
  1224.         else {
  1225.             Mas[tot].kolvo_sotrud++;
  1226.             Mas[tot].stoimost_proekta = Mas[tot].stoimost_proekta + (stoi(Proj[i].stoimost_chas) * stoi(Proj[i].kolvo_chas));
  1227.             if (Proj[i].vid_rab == "Работа над требованиями") { Mas[tot].perechen_rabot[0] = 1; Mas[tot].perechen_rabot_st[0] = Mas[tot].perechen_rabot_st[0] + (stoi(Proj[i].stoimost_chas) * stoi(Proj[i].kolvo_chas)); }
  1228.             else
  1229.                 if (Proj[i].vid_rab == "Разработка архитектуры") { Mas[tot].perechen_rabot[1] = 1; Mas[tot].perechen_rabot_st[1] = Mas[tot].perechen_rabot_st[1] + (stoi(Proj[i].stoimost_chas) * stoi(Proj[i].kolvo_chas)); }
  1230.                 else
  1231.                     if (Proj[i].vid_rab == "Реализация") { Mas[tot].perechen_rabot[2] = 1; Mas[tot].perechen_rabot_st[2] = Mas[tot].perechen_rabot_st[2] + (stoi(Proj[i].stoimost_chas) * stoi(Proj[i].kolvo_chas)); }
  1232.                     else
  1233.                         if (Proj[i].vid_rab == "Тестирование") { Mas[tot].perechen_rabot[3] = 1; Mas[tot].perechen_rabot_st[3] = Mas[tot].perechen_rabot_st[3] + (stoi(Proj[i].stoimost_chas) * stoi(Proj[i].kolvo_chas)); }
  1234.         }
  1235.     }
  1236.  
  1237.     for (int i = 0; i < kol; i++) {
  1238.         cout << " Проект: " << Mas[i].name_proj << endl;
  1239.         cout << " Стоимость проекта: " << Mas[i].stoimost_proekta << "руб." << endl;
  1240.         cout << " Сотрудников: " << Mas[i].kolvo_sotrud << endl;
  1241.         cout << " Виды работ: " << endl;
  1242.         if (Mas[i].perechen_rabot[0] == 1) cout << "     Работа над требованиями - " << Mas[i].perechen_rabot_st[0] << "руб." << endl;
  1243.         if (Mas[i].perechen_rabot[1] == 1) cout << "     Разработка архитектуры - " << Mas[i].perechen_rabot_st[1] << "руб." << endl;
  1244.         if (Mas[i].perechen_rabot[2] == 1) cout << "     Реализация - " << Mas[i].perechen_rabot_st[2] << "руб." << endl;
  1245.         if (Mas[i].perechen_rabot[3] == 1) cout << "     Тестирование - " << Mas[i].perechen_rabot_st[3] << "руб." << endl;
  1246.         cout << endl;
  1247.         cout << endl;
  1248.     }
  1249.     system("pause");
  1250.     system("cls");
  1251. }
Add Comment
Please, Sign In to add comment