zsyxh • 11个月前
这是从小到大排序吧
评论:
#include<iostream>
#include<algorithm>
using namespace std;
struct student
{
string s;
int y,m,d;
};
student a[10001];
bool cmp(student x,student z)
{
if(x.y<=z.y)
{
return 1;
}
if(x.y>=z.y)
{
return 0;
}
}
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i].s>>a[i].y>>a[i].m>>a[i].d;
}
sort(a+1,a+n+1,cmp);
for(int i=1;i<=n;i++)
{
cout<<a[i].s<<endl;
}
return 0;
}