//此题描述有问题,最高分是按照什么标准?
//这个程序是按照三科成绩总成绩的最高分
#include <iostream>
using namespace std;
struct student{
string number;
string name;
float score[3];
};
int main ()
{
int n,max_i=0;
float avg[3]={0},max=0;
cin>>n;
student *p=new student [n];
for(int i=0;i<n;i++){
cin>>(*(p+i)).number;
cin>>(*(p+i)).name;
float max1=0;
for(int j=0;j<3;j++){
cin>>(*(p+i)).score[j];
avg[j]+=(*(p+i)).score[j];
max1+=(*(p+i)).score[j];
}
if(max<max1){
max=max1;
max_i=i;
}
}
for(int i=0;i<3;i++){
avg[i]/=n;
cout<<avg[i]<<" ";
}
cout<<endl;
cout<<(*(p+max_i)).number<<" ";
cout<<(*(p+max_i)).name<<" ";
for(int j=0;j<3;j++)
cout<<(*(p+max_i)).score[j]<<" ";
cout<<endl;
return 0;
}
0.0分
0 人评分