1004 成绩排名
作者:互联网
1004 成绩排名
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
struct Student
{
string Name;
string Id;
int Score;
};
bool Compare(Student &a,Student &b)
{
return a.Score>b.Score;
}
int main()
{
int n;
cin>>n;
Student *stu=new Student[n];
for(int i=0;i<n;i++)
{
cin>>stu[i].Name>>stu[i].Id>>stu[i].Score;
}
sort(stu,stu+n,Compare);
cout<<stu[0].Name<<" "<<stu[0].Id<<endl;
cout<<stu[n-1].Name<<" "<<stu[n-1].Id<<endl;
return 0;
}
标签:成绩排名,include,int,stu,Score,Student,1004 来源: https://blog.csdn.net/bailichen800/article/details/114795727