Advertisement
Guest User

Untitled

a guest
May 26th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. struct sportsmen {
  4. double score;
  5. };
  6. void f(int i,sportsmen *d) {
  7. int s[5];
  8. for (int f(0); f < 5; f++) {
  9. cout << "Введите "<<f+1<<" оценку " << i + 1 << " спортсмена :";cin >> s[f];
  10. }
  11. int sum = 0;
  12. for (int f(0); f < 5; f++)
  13. sum += s[f];
  14. d[i].score = sum / 5;
  15. }
  16. int main() {
  17. setlocale(LC_ALL, "Russian");
  18. const int constant = 2;
  19. sportsmen a[constant];
  20. double max = 0.0;
  21. for (int i(0); i < constant; i++)
  22. f(i, a);
  23. for (int i(0); i < constant; i++)
  24. if (a[i].score > max)
  25. max = a[i].score;
  26. system("cls");
  27. cout << "Победители:" << endl << endl;
  28. for (int i(0); i < constant; i++)
  29. if (a[i].score == max)
  30. cout << "Спортсмен номер " << i + 1 << " с результатом " << a[i].score << " балл" << endl;
  31. system("pause");
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement