Advertisement
SenyaSych

Untitled

Mar 15th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <conio.h>
  3. #include <iomanip>
  4. #include <iostream>
  5. #include <stdio.h>
  6. #include <time.h>
  7. #include <string>
  8. #include <Windows.h>
  9. #include <math.h>
  10. #include <fstream>
  11. using namespace std;
  12. struct
  13.     {
  14.         string name;
  15.         int scount,fcount,kcount;
  16.  
  17.  
  18.     } mas[4];
  19.  
  20.  
  21.  
  22.     ifstream fin;
  23.     ofstream fout;
  24.  
  25.  
  26. int main()
  27. {
  28.  
  29.     fin.open("in.txt");
  30.     for (int i = 0; i <4; i++)
  31.     {
  32.     fin >> mas[i].name;
  33.     fin >> mas[i].scount;
  34.     fin >> mas[i].fcount;
  35.     fin >> mas[i].kcount;
  36.     }
  37.     fin.close();
  38.     fout.open("out.txt");
  39.  
  40.     fout << "Данные о вузе с максимальным числом студентов: \n";
  41.     int k = 0;
  42.     int ind = 0;
  43.  
  44.     for (int i = 0; i < 4; i++){
  45.         if (mas[i].scount > k){
  46.             k = mas[i].scount;
  47.             ind = i;
  48.         }
  49.         }
  50.  
  51.         fout << mas[ind].name<< "  ";
  52.         fout << mas[ind].scount<< "  ";
  53.         fout << mas[ind].fcount<< "  ";
  54.         fout << mas[ind].kcount<< "  \n";
  55.     fout.close();
  56.  
  57.  
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement