Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <windows.h>
- #include <cstring>
- using namespace std;
- struct office
- {
- string id;
- string name;
- string pos;
- string department;
- int salary[12];
- int year = 0;
- };
- struct buffer
- {
- string id;
- int salary[12];
- };
- int main()
- {
- SetConsoleOutputCP(1251);
- SetConsoleCP(1251);
- setlocale(LC_ALL,"");
- ifstream fin("dat.txt", ios::binary);
- ifstream fin2("dat2.txt", ios::binary);
- ofstream fout("result.txt", ios::binary);
- office worker[9];
- buffer buff[9];
- for(int i = 0; i < 9; i++)
- {
- fin2 >> buff[i].id;
- cout << buff[i].id << "\t";
- for (int j = 0; j < 12; j++)
- {
- fin2 >> buff[i].salary[j];
- cout << buff[i].salary[j] << " ";
- }
- cout << endl;
- }
- for(int i = 0; i < 9; i++)
- {
- getline(fin,worker[i].id);
- getline(fin,worker[i].name);
- getline(fin,worker[i].pos);
- getline(fin,worker[i].department);
- if (buff[i].id == worker[i].id)
- {
- for(int j = 0; j < 12; j++)
- {
- worker[i].salary[j] = buff[j].salary[j];
- }
- }
- }
- for (int i = 0; i < 9; i++)
- {
- fout << "\nID : " << worker[i].id << "\nName : " << worker[i].name << "\nPos : " << worker[i].pos;
- fout << "\nDepartment: " << worker[i].department;
- fout << endl;
- fout << "Зарплаты : ";
- for (int j = 0; j < 12; j++)
- fout << worker[i].salary[j] << " ";
- fout << endl;
- }
- }
- /* dat
- 1461
- Иванов Иван Иванович
- Бухгалтер
- Бухгалтерский
- 2462
- Петров Петр Петрович
- Помощник бухгалтера
- Бухгалтерский
- 3463
- Смирнов Олег Романович
- Начальник отдела
- Бухгалтерский
- 4588
- Иванов Петр Иванович
- Начальник отдела
- Расчетный
- 5589
- Петров Петр Петрович
- Зам.начальника
- Расчетный
- 6590
- Смирнов Олег Романович
- Менеджер
- Расчетный
- 7634
- Иванов Иван Олегович
- Главный юрист
- Юридический
- 8635
- Смирнов Петр Артемович
- Юрист
- Юридический
- 9636
- Смирнов Олег Романович
- Помощник юриста
- Юридический
- */
- /* dat2
- 1461
- 45000 47000 46000 45500 48000 55000 46700 48000 47900 44950 45300 48400
- 2462
- 45000 47000 49000 45500 48000 53000 49700 46000 47900 47950 44300 49400
- 3463
- 115000 153500 110000 115000 107000 150000 110000 110000 95000 110000 120000 115000
- 4588
- 115000 152000 110000 115000 107000 150000 110000 110000 95000 110000 120000 115000
- 5589
- 37100 38200 34900 35000 36000 37000 38100 39100 39400 39000 45000 35100
- 6590
- 55000 59000 61200 58900 53600 55100 57000 57000 57000 57000 57500 59000
- 7634
- 110000 100000 110000 115000 107000 115000 95000 110000 110000 110000 110000 120000
- 8635
- 61200 61200 61200 61200 61200 61200 73400 73500 73500 75000 75000 75000
- 9636
- 61200 61200 61200 61200 61200 61200 73400 73500 73500 75000 75000 75000
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement