Advertisement
mercMatvey4

Untitled

Feb 24th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <windows.h>
  4. #include <cstring>
  5.  
  6. using namespace std;
  7.  
  8. struct office
  9. {
  10. string id;
  11. string name;
  12. string pos;
  13. string department;
  14. int salary[12];
  15. int year = 0;
  16. };
  17.  
  18. struct buffer
  19. {
  20. string id;
  21. int salary[12];
  22. };
  23.  
  24. int main()
  25. {
  26. SetConsoleOutputCP(1251);
  27. SetConsoleCP(1251);
  28. setlocale(LC_ALL,"");
  29. ifstream fin("dat.txt", ios::binary);
  30. ifstream fin2("dat2.txt", ios::binary);
  31. ofstream fout("result.txt", ios::binary);
  32. office worker[9];
  33. buffer buff[9];
  34. for(int i = 0; i < 9; i++)
  35. {
  36. fin2 >> buff[i].id;
  37. cout << buff[i].id << "\t";
  38. for (int j = 0; j < 12; j++)
  39. {
  40. fin2 >> buff[i].salary[j];
  41. cout << buff[i].salary[j] << " ";
  42. }
  43. cout << endl;
  44. }
  45. for(int i = 0; i < 9; i++)
  46. {
  47. getline(fin,worker[i].id);
  48. getline(fin,worker[i].name);
  49. getline(fin,worker[i].pos);
  50. getline(fin,worker[i].department);
  51. if (buff[i].id == worker[i].id)
  52. {
  53. for(int j = 0; j < 12; j++)
  54. {
  55. worker[i].salary[j] = buff[j].salary[j];
  56. }
  57. }
  58. }
  59. for (int i = 0; i < 9; i++)
  60. {
  61. fout << "\nID : " << worker[i].id << "\nName : " << worker[i].name << "\nPos : " << worker[i].pos;
  62. fout << "\nDepartment: " << worker[i].department;
  63. fout << endl;
  64. fout << "Зарплаты : ";
  65. for (int j = 0; j < 12; j++)
  66. fout << worker[i].salary[j] << " ";
  67. fout << endl;
  68. }
  69. }
  70.  
  71. /* dat
  72. 1461
  73. Иванов Иван Иванович
  74. Бухгалтер
  75. Бухгалтерский
  76. 2462
  77. Петров Петр Петрович
  78. Помощник бухгалтера
  79. Бухгалтерский
  80. 3463
  81. Смирнов Олег Романович
  82. Начальник отдела
  83. Бухгалтерский
  84. 4588
  85. Иванов Петр Иванович
  86. Начальник отдела
  87. Расчетный
  88. 5589
  89. Петров Петр Петрович
  90. Зам.начальника
  91. Расчетный
  92. 6590
  93. Смирнов Олег Романович
  94. Менеджер
  95. Расчетный
  96. 7634
  97. Иванов Иван Олегович
  98. Главный юрист
  99. Юридический
  100. 8635
  101. Смирнов Петр Артемович
  102. Юрист
  103. Юридический
  104. 9636
  105. Смирнов Олег Романович
  106. Помощник юриста
  107. Юридический
  108.  
  109. */
  110.  
  111. /* dat2
  112. 1461
  113. 45000 47000 46000 45500 48000 55000 46700 48000 47900 44950 45300 48400
  114. 2462
  115. 45000 47000 49000 45500 48000 53000 49700 46000 47900 47950 44300 49400
  116. 3463
  117. 115000 153500 110000 115000 107000 150000 110000 110000 95000 110000 120000 115000
  118. 4588
  119. 115000 152000 110000 115000 107000 150000 110000 110000 95000 110000 120000 115000
  120. 5589
  121. 37100 38200 34900 35000 36000 37000 38100 39100 39400 39000 45000 35100
  122. 6590
  123. 55000 59000 61200 58900 53600 55100 57000 57000 57000 57000 57500 59000
  124. 7634
  125. 110000 100000 110000 115000 107000 115000 95000 110000 110000 110000 110000 120000
  126. 8635
  127. 61200 61200 61200 61200 61200 61200 73400 73500 73500 75000 75000 75000
  128. 9636
  129. 61200 61200 61200 61200 61200 61200 73400 73500 73500 75000 75000 75000
  130. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement