要求:将Person自定义数据类型进行排序,Person中有姓名,年龄,身高
排序规则:年龄升序,如果年龄相同在按照身高进行降序。
源码:
#include <iostream>
#include <list>
#include <algorithm>
using namespace std;
class Person
{
public:
Person(string name,int age,int height):m_Name(name),m_Age(age),m_Height(height){
}
string m_Name;//姓名
int m_Age;//年龄
int m_Height;//身高
};
//指定排序规则
bool comparePerson(Person&am