Advertisement
Zyazev

Сессия 17б

Mar 15th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. using namespace std;
  5. struct date
  6. {
  7. int day;
  8. int month;
  9. int year;
  10. };
  11. struct pupil
  12. {
  13. char name[15];
  14. int score;
  15. };
  16. struct ss
  17. {
  18. int group;
  19. string subject;
  20. char teacher[15];
  21. date edate;
  22. pupil epupil;
  23. };
  24. void main()
  25. {
  26. setlocale(LC_ALL, "Russian");
  27. ss exam; double k=0;
  28. ifstream fin("vdm.txt");
  29. while(!fin.eof())
  30. {
  31. fin>>exam.group; cout<<exam.group<<" ";
  32. fin>>exam.subject; cout<<exam.subject<<" ";
  33. fin>>exam.teacher; cout<<exam.teacher<<" ";
  34. fin>>exam.edate.day; cout<<exam.edate.day<<".";
  35. fin>>exam.edate.month; cout<<exam.edate.month<<".";
  36. fin>>exam.edate.year; cout<<exam.edate.year<<endl;
  37. for (int i=0; i<15; i++)
  38. {
  39. fin>>exam.epupil.name; cout<<exam.epupil.name<<" ";
  40. fin>>exam.epupil.score;
  41. if (exam.epupil.score>=56&&exam.subject=="Матанализ")
  42. k++;
  43. cout<<exam.epupil.score<<endl;
  44. }
  45. }
  46. fin.close();
  47. cout<<k/double(45)*100<<" процентов студентов успешно сдали матанализ"<<endl;
  48. system("pause");
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement