SHARE
TWEET

Untitled

a guest Mar 21st, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int main()
  2. {
  3.     // ...
  4.     auto employee_less_than = [] (const Employee& lhs, const Employee& rhs)
  5.             {
  6.                 return lhs.get_balance() < rhs.get_balance();
  7.             };
  8.     std::vector<Employee> employees_sorted;
  9.     // ...
  10.     int total_funds /* = ... */;
  11.     std::sort(employees_sorted.begin(), employees_sorted.end(), employee_less_than);
  12.     for (auto& e : employees_sorted) {
  13.         if (e.get_salary() <= total_funds) {
  14.             total_funds -= e.get_salary();
  15.             e.pay_salary();
  16.         }
  17.     }
  18.     // ...
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top