#include <stdio.h>
#include <algorithm>
// #include <vector>c
#include <iostream>
using namespace std;
typedef struct student{
char name[20];
int math;
int english;
} Student;
boo cmp(Student a, Student b);
main() {
Student a[3] = {{"apple",67,89},{"limei",90,56},{"egg",90,90}};
sort(a, a+2, cmp);
for (int i = 0; i < 3; i++) {
cout << a[i].name << " ";
}
}
bool cmp(Student a, Student b)
{
if (a.math > b.math) {
return a.math < b.math; // 按math从小到大顺序排序
} else if (a.math == b.math)
return a.english > b.english;
}