7-7 通讯录排序 (10 分)
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
struct Person{
string name;
int birthday;
string number;
bool operator < (const Person &h) const {
return birthday < h.birthday;
}
}p[20];
int main()
{
int n;
cin >> n;
string s1, s2; int a;
for (int i=0; i<n; i++) {
cin >> s1 >> a >> s2;
p[i] = {s1, a, s2};
}
sort(p, p+n);
for (int i=0; i<n; i++) {
cout << p[i].name << ' ' << p[i].birthday << ' ' << p[i].number << endl;
}
return 0;
}