代码
#include<iostream>
using namespace std;
int main()
{
struct Student
{
int num;
char name[20];
double score;
}student1,student2;
cin>>student1.num>>student1.score;
fgets(student1.name,20,stdin);
cin>>student2.num>>student2.score;
fgets(student2.name,20,stdin);
if(student1.score>student2.score) cout<<student1.num<<student1.name<<student1.score<<endl;
else cout<<student2.num<<student2.name<<student2.score<<endl;
return 0;
}
输入
10101 89 wang
10103 90 lin
输出结果
10103 lin
90