Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using namespace std;
- struct transport{
- char Name[32];
- char LastName[32];
- char MiddleName[32];
- int Baggage;
- int Mass;
- int summbag[10];
- };
- int main()
- {
- int kolvo,count = 0,count2 = 0;
- cout << "Введите кол-во пассажиров: ";
- cin >> kolvo;
- transport People[kolvo];
- for(int i = 0; i < kolvo; i++)
- {
- cout << "Фамилия: ";
- cin >> People[i].LastName;
- cout << "Имя: ";
- cin >> People[i].Name;
- cout << "Отчество: ";
- cin >> People[i].LastName;
- cout << "Количество Багажа: ";
- cin >> People[i].Baggage;
- for (int j = 0; j < People[i].Baggage; j++)
- {
- cout << "Масса Багажа " << j + 1<< ": ";
- cin >> People[i].Mass;
- People[i].summbag[j] += People[i].Mass;
- }
- cin.get();
- cout << endl;
- }
- for(int i = 0; i < kolvo; i++)
- {
- for(int j = 0; j < People[i].Baggage; j ++)
- {
- count += People[i].summbag[j];
- if((j == People[i].Baggage -1 ) and count > 30)
- {
- count2 ++;
- }
- }
- count = 0;
- }
- cout << "Кол-во Пассажиров с багажом более 30 кг = " << count2 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement