#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
class Student
{
public:
Student(const string &Name, int Age) : name(Name), age(Age)
{ }
string name;
int age;
bool operator < (const Student x) const
{
return age < x.age;
}
bool operator > (const Student x) const
{
return age > x.age;
}
};
bool cmp(const Student &stu1, const Student &stu2)
{
if (stu1.age < stu2.age)
{
return true;
}
else
return false;
}
int main()
{
vector<Student> vec;
vec.push_back(Student("qqqwww", 19));
vec.push_back(Student("Tom", 9));
vec.push_back(Student("Jerry", 21));
sort(vec.begin(), vec.end());
//返回最大Student元素的name
Student eldest = *max_element(vec.begin(), vec.end());
cout << eldest.name;
//cout << endl;
//system("pause");
return 0;
}