Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- // ...
- auto employee_less_than = [] (const Employee& lhs, const Employee& rhs)
- {
- return lhs.get_balance() < rhs.get_balance();
- };
- std::vector<Employee> employees_sorted;
- // ...
- int total_funds /* = ... */;
- std::sort(employees_sorted.begin(), employees_sorted.end(), employee_less_than);
- for (auto& e : employees_sorted) {
- if (e.get_salary() <= total_funds) {
- total_funds -= e.get_salary();
- e.pay_salary();
- }
- }
- // ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement