学生个数:N个
成绩:语文,数学,英语,总成绩
就着些东西,下面直接上代码
#include <bits/stdc++.h>
using namespace std;
struct student //开个结构体
{
string name;
int yu,shu,ying,zong;
};
int main()
{
student s[1005];
int n,mark,max=-1,tmp;
cin>>n;
for (int i=1;i<=n;i++)
{
cin>>s[i].name>>s[i].yu>>s[i].shu>>s[i].ying; //读入数据
tmp = s[i].yu+s[i].shu+s[i].ying;
if (tmp>max) //比较不用说
{
max=tmp;
mark=i;
}
}
cout<<s[mark].name<<" "<<s[mark].yu<< " " <<s[mark].shu<< " "<<s[mark].ying; //输出
return 0; //完事
}
你学废了么?