XPKAAA @ 2021-07-31 18:17:40
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int mmax,sum,n;
struct student
{
char name;
int chinese,maths,english,num;
}a[1005];
int main()
{
cin>>n;
for(int i=1; i<=n; i++)
{
cin>>a[i].name>>a[i].chinese>>a[i].maths>>a[i].english;
a[i].num=a[i].chinese+a[i].maths+a[i].english;
if(a[i].num>mmax)
{
sum=i;
mmax=a[i].num;
}
}
cout<<a[sum].name<<a[sum].chinese<<a[sum].maths<<a[sum].english;
}
by 0htoAi @ 2021-07-31 18:21:58
char类型是单个字符,你要不然用string,要不然用char name[100]啥的
by XPKAAA @ 2021-07-31 18:26:55
@hanhan_zz 感谢,我过了