Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <cstdlib>
- #include <iostream>
- #include <fstream>
- #include <conio.h>
- #include <windows.h>
- #include <string.h>
- using namespace std;
- int main()
- {
- //SetConsoleCP(1251);
- //SetConsoleOutputCP(1251);
- setlocale(LC_ALL,"rus");
- ifstream file("C:\\Users\\kbstudentint\\Desktop\\О сотрудниках.txt");//путь к файлу
- char open_file[400];
- int z[6],z1[6],z3[6];
- int index = -1;
- int buf, buf1, buf2,sum,sum1,sum2;
- do
- {
- index++;
- if (index == 4 ) //Проверка номера строки
- {
- z[0] = atoi(open_file);
- }
- if (index == 5)
- {
- z[1] = atoi(open_file);
- }
- if (index == 6)
- {
- z[2] = atoi(open_file);
- }
- if (index == 7)
- {
- z[3] = atoi(open_file);
- }
- if (index == 8)
- {
- z[4] = atoi(open_file);
- }
- if (index == 9)
- {
- z[5] = atoi(open_file);
- }
- if (index == 13)
- {
- z1[0] = atoi(open_file);
- }
- if (index == 14)
- {
- z1[1] = atoi(open_file);
- }
- if (index == 15)
- {
- z1[2] = atoi(open_file);
- }
- if (index == 16)
- {
- z1[3] = atoi(open_file);
- }
- if (index == 17)
- {
- z1[4] = atoi(open_file);
- }
- if (index == 18)
- {
- z1[5] = atoi(open_file);
- }
- if (index == 22)
- {
- z3[0] = atoi(open_file);
- }
- if (index == 23)
- {
- z3[1] = atoi(open_file);
- }
- if (index == 24)
- {
- z3[2] = atoi(open_file);
- }
- if (index == 25)
- {
- z3[3] = atoi(open_file);
- }
- if (index == 26)
- {
- z3[4] = atoi(open_file);
- }
- if (index == 27)
- {
- z3[5] = atoi(open_file);
- }
- file.getline(open_file, 400);//считывает одну строку файла
- } while (!file.eof());
- /**/
- _asm{ xor ebx,ebx}
- for (int i = 0; i < 6; i++) //находим сумму зарплат
- {
- buf = z[i];
- _asm
- {
- xor eax, eax
- mov eax,buf
- add ebx,eax
- mov sum,ebx
- }
- }
- _asm{ xor ebx, ebx}
- for (int i = 0; i < 6; i++)
- {
- buf1 = z1[i];
- _asm
- {
- xor eax, eax
- mov eax, buf1
- add ebx, eax
- mov sum1, ebx
- }
- }
- _asm{ xor ebx, ebx}
- for (int i = 0; i < 6; i++)
- {
- buf2 = z3[i];
- _asm
- {
- xor eax, eax
- mov eax, buf2
- add ebx, eax
- mov sum2, ebx
- }
- }
- double sums = sum, sra, n = 6.0, sums1 = sum1,sums2 = sum2, sra1, sra2;
- //делим и находим СРА
- _asm
- {
- xor eax,eax
- xor ebx,ebx
- FINIT
- fld sums
- fdiv n
- fstp sra
- }
- _asm
- {
- xor eax, eax
- xor ebx, ebx
- FINIT
- fld sums1
- fdiv n
- fstp sra1
- }
- _asm
- {
- xor eax, eax
- xor ebx, ebx
- FINIT
- fld sums2
- fdiv n
- fstp sra2
- }
- cout << "1 Сотрудник: " << endl;
- cout << "Зарплаты:" << endl;
- for (int i = 0; i < 6; i++)
- {
- cout << z[i] << endl;
- }
- cout << "Средняя зарплата " << sra<<endl;
- cout <<endl<< "2 Сотрудник: " << endl;
- cout << "Зарплаты:" << endl;
- for (int i = 0; i < 6; i++)
- {
- cout << z1[i] << endl;
- }
- cout << "Средняя зарплата " << sra1 << endl;;
- cout <<endl<< "3 Сотрудник: " << endl;
- cout << "Зарплаты:" << endl;
- for (int i = 0; i < 6; i++)
- {
- cout << z3[i] << endl;
- }
- cout << "Средняя зарплата " << sra2;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement