Advertisement
Guest User

Untitled

a guest
Feb 12th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <windows.h>
  4. using namespace std;
  5.  
  6. struct Students
  7. {
  8. string Name;
  9. float at;
  10. float sr;
  11. int ses[4];
  12. };
  13.  
  14. int main()
  15. {
  16. float sum = 0;
  17. SetConsoleOutputCP(1251);
  18. SetConsoleCP(1251);
  19. setlocale(LC_ALL,"");
  20. Students gr[5];
  21. for (int i = 0; i < 5; i++)
  22. {
  23. cout << "Имя : ";
  24. cin >> gr[i].Name;
  25. cout << "Средний бал за аттестат : ";
  26. cin >> gr[i].at;
  27. cout << "Оценки за последнюю сессию : ";
  28. for (int j = 0; j < 4; j++)
  29. cin >> gr[i].ses[j];
  30. cout << endl;
  31. }
  32. for (int i = 0; i < 5; i++)
  33. {
  34. for (int j = 0; j < 4; j++)
  35. {
  36. sum += gr[i].ses[j];
  37. }
  38. gr[i].sr = sum / 4;
  39. sum = 0;
  40. }
  41. cout << "Студенты, у которых средний балл по итогам сессии ниже среднего балла аттестата\n";
  42. for (int i = 0; i < 5; i++)
  43. {
  44. if (gr[i].sr < gr[i].at) cout << "Имя: " << gr[i].Name << "\n" << "Средний бал аттестата : " << gr[i].at << "\n" << "Средняя оценка за экзамен : " << gr[i].sr << "\n";
  45. cout << endl;
  46. }
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement