Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by natali ( 14 years ago )
// natali2.cpp: определяет точку входа для консольного приложения.
// вариант 7.
// Информация об учащихся спортивных соревнований содержит: наименование страны, название команды, ФИО игрока,
// игровой номер, возраст, рост, вес. Вывести инф-ию о самой молодой, рослой и легкой команде.
#include "stdafx.h"
#include <iostream>
#include <conio.h>
using namespace std;
struct igrok
{
char FIO[30];
int ID;
int Age;
int Height;
int Weight;
};
struct komanda
{
char Strana[20];
char Name[20];
igrok mas[15];
};
int _tmain(int argc, _TCHAR* argv[])
{
komanda array[10];
double masA[10];
double masH[10];
double masW[10];
cout << "Vvedite k-lvo komand: ";
int n;
cin >> n;
cout << "Vvedite inf o komandah\n";
for(int i=0; i<n; i++)
{
masA[i]=0;
masH[i]=0;
masW[i]=0;
cout << "_____________________________________________";
cout << "\nKomanda " << i+1 <<endl;
cout << "Strana: ";
cin.get();
cin.getline(array[i].Strana,19);
cout << "Name: ";
cin.getline(array[i].Name,19);
cout << "Vvedite kol-vo igrokov: ";
int m;
cin >> m;
cout << "Vvedite inf ob igrokah\n";
for(int j=0; j<m; j++)
{
cout << "\nIgrok " << j+1 <<endl;
cout << "FIO: ";
cin.get();
cin.getline(array[i].mas[j].FIO,29);
cout << "ID: ";
cin >> array[i].mas[j].ID;
cout << "Age: ";
cin >> array[i].mas[j].Age;
masA[i]=masA[i]+(double)array[i].mas[j].Age;
cout << "Height: ";
cin >> array[i].mas[j].Height;
masH[i]=masH[i]+(double)array[i].mas[j].Height;
cout << "Weight: ";
cin >> array[i].mas[j].Weight;
masW[i]=masW[i]+(double)array[i].mas[j].Weight;
}
masA[i]=masA[i]/m;
masH[i]=masH[i]/m;
masW[i]=masW[i]/m;
}
for(int i=0; i<n; i++)
{
cout << endl << masA[i] << " " << masH[i] << " " << masW[i];
}
cout << endl;
double maxA=100;
int A;
double maxH=1;
int H;
double maxW=150;
int W;
for(int i=0; i<n; i++)
{
if (masA[i]<maxA)
{
maxA=masA[i];
A=i;
}
if (masH[i]>maxH)
{
maxH=masH[i];
H=i;
}
if (masW[i]<maxW)
{
maxW=masW[i];
W=i;
}
}
cout << "Samaya molodaya komanda: ";
printf(array[A].Strana);
cout << " ";
printf(array[A].Name);
cout << "\nSamaya roslaya komanda: ";
printf(array[H].Strana);
cout << " ";
printf(array[H].Name);
cout << "\nSamaya legkaya komanda: ";
printf(array[W].Strana);
cout << " ";
printf(array[W].Name);
getch();
return 0;
}
Revise this Paste