SHARE
TWEET

Untitled

a guest Feb 27th, 2020 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <iterator>
  4. #include <algorithm>
  5. #include <map>
  6. #include <numeric>
  7.  
  8. struct CELL {
  9.     std::string family;
  10.     int salary;
  11.  
  12.     bool operator<(const CELL& other) const
  13.     {
  14.         return salary < other.salary;
  15.     }
  16.  
  17.     bool operator>(const CELL& other) const
  18.     {
  19.         return salary > other.salary;
  20.     }
  21. };
  22.  
  23.  
  24. //int main() {
  25. //  std::map <std::string, std::vector<int>> salaryVector = { {"Ivanov", {37000, 45564}}, {"Petrov", {27000, 45456} } };
  26. //  std::vector <CELL> VforOutput;
  27. // 
  28. //  for (const auto& x : salaryVector) {
  29. //      CELL cell;
  30. //      int sum = std::accumulate(x.second.begin(), x.second.end(), 0);
  31. //      cell.family = x.first;
  32. //      cell.salary = sum;
  33. //      VforOutput.push_back(cell);
  34. //  };
  35. // 
  36. //  std::sort(VforOutput.begin(), VforOutput.end(), std::greater<CELL>());
  37. //  for (auto i : VforOutput) {
  38. //      std::cout << i.family << " " << i.salary << std::endl;
  39. //  }
  40. //}
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