Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <stdio.h>
- #include <iostream>
- #include <clocale>
- using namespace std;
- void info(float x[][2])
- {
- int i;
- for (i = 0; i < 5; i++) {
- cout « "\n У пассажира " « i+1 « " " « x[i][0] « " предметов багажа, весом " « x[i][1] « " кг.\n";
- }
- }
- int main()
- {
- setlocale(LC_CTYPE, "rus");
- float passengers[5][2] = {
- {5, 3},
- {1, 6},
- {4, 1},
- {5, 7.5},
- {10, 18.7}
- };
- int i, nmax; float max;
- for (i = 0, max = passengers[0][1], nmax = 0; i < 5; i++)
- if (max < passengers[i][1])
- {
- max = passengers[i][1];
- nmax = i;
- }
- info(passengers);
- cout « "У пассажира номер " « nmax « " самый тяжёлый багаж. Количество предметов - " « passengers[nmax][0] «
- ", а вес - " « max « " кг.\n";
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement