Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct sportsmen {
- double score;
- };
- void f(int i,sportsmen *d) {
- int s[5];
- for (int f(0); f < 5; f++) {
- cout << "Введите "<<f+1<<" оценку " << i + 1 << " спортсмена :";cin >> s[f];
- }
- int sum = 0;
- for (int f(0); f < 5; f++)
- sum += s[f];
- d[i].score = sum / 5;
- }
- int main() {
- setlocale(LC_ALL, "Russian");
- const int constant = 2;
- sportsmen a[constant];
- double max = 0.0;
- for (int i(0); i < constant; i++)
- f(i, a);
- for (int i(0); i < constant; i++)
- if (a[i].score > max)
- max = a[i].score;
- system("cls");
- cout << "Победители:" << endl << endl;
- for (int i(0); i < constant; i++)
- if (a[i].score == max)
- cout << "Спортсмен номер " << i + 1 << " с результатом " << a[i].score << " балл" << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement