#include #include // left, setw #include #include #include // pair #include using namespace std; using Emp = pair; using MAP = map; class Zakr { int min,max; public: Zakr(int min,int max) : min(min), max(max) {} bool operator()(const pair& p) const { int zarobki = p.second.second; return (min < zarobki) && (zarobki < max); } }; void druk(const MAP& m) { for (auto [key, emp] : m) { auto [name, zar] = emp; cout << "Klucz: " << left << setw(7) << key << "Imie: " << setw(10) << name << "Zarobki: " << zar << endl; } } int main() { MAP emp; emp["jan"] = Emp("Jan K.", 1900); emp["piotr"] = Emp("Piotr M.", 2100); emp["ola"] = Emp("Ola S.", 3100); emp["prezes"] = Emp("Prezes", 9900); emp["adam"] = Emp("Adam A.", 1600); emp["emilia"] = Emp("Emilia P.", 2600); druk(emp); int mn = 1100, mx = 2000; int ile = count_if(emp.begin(),emp.end(), Zakr(mn,mx)); cout << ile << " osob ma zarobki w zakresie od " << mn << " do " << mx << endl; }