//Exercise P11.10, sort a vector of Employee objects by salary using the standard C++ sort function.
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include "ccc_empl.h"
using namespace std;
bool operator<(const Employee& a, const Employee&b)
{
return a.get_salary() < b.get_salary();
}
int main()
{
vector<Employee> list;
list.push_back(Employee ("Sean Lee", 40000));
list.push_back(Employee ("Kevin Lee", 30000));
list.push_back(Employee ("Chee Yang", 50000));
sort( list.begin(), list.end() );
for (unsigned int i = 0; i < list.size(); i++){
cout << "Employee name: " << list[i].get_name() << "\n";
cout << "Salary: " << list[i].get_salary() << "\n";
}
return 0;
}