文章
55
粉丝
100
获赞
12
访问
31.1k
#include<stdio.h>
#include<string.h>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
struct student{
string name;
int age;
float score;
};
bool cmp(student a, student b){
if(a.score != b.score){
return a.score < b.score;
}else if(a.name != b.name){
return a.name < b.name;
}else{
return a.age < b.age;
}
}
int main(){
int n;
while(cin>>n){
struct student stu[1000];
for(int i = 0; i<n; i++){
cin>>stu[i].name>>stu[i].age>>stu[i].score;
}
sort(stu,stu+n,cmp);
for(int i = 0; i<n; i++){
cout<<stu[i].name<<" "<<stu[i].age<<" "<<stu[i].score<<endl;
}
}
}
登录后发布评论
暂无评论,来抢沙发