Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <iterator>
- #include <algorithm>
- #include <map>
- #include <numeric>
- struct CELL {
- std::string family;
- int salary;
- bool operator<(const CELL& other) const
- {
- return salary < other.salary;
- }
- bool operator>(const CELL& other) const
- {
- return salary > other.salary;
- }
- };
- //int main() {
- // std::map <std::string, std::vector<int>> salaryVector = { {"Ivanov", {37000, 45564}}, {"Petrov", {27000, 45456} } };
- // std::vector <CELL> VforOutput;
- //
- // for (const auto& x : salaryVector) {
- // CELL cell;
- // int sum = std::accumulate(x.second.begin(), x.second.end(), 0);
- // cell.family = x.first;
- // cell.salary = sum;
- // VforOutput.push_back(cell);
- // };
- //
- // std::sort(VforOutput.begin(), VforOutput.end(), std::greater<CELL>());
- // for (auto i : VforOutput) {
- // std::cout << i.family << " " << i.salary << std::endl;
- // }
- //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement