#include #include #include using namespace std; class person { public: string fname, lname; double salary; string dept; person(string f, string l, double s, string d) { fname = f; lname = l; salary = s; dept = d; }; void print() { cout << fname << " " << lname << " $" << salary << " of " << dept << "\n"; } }; vector employees; void add_employee(string f, string l, double s, string d) { person * p = new person(f, l, s, d); employees.push_back(p); } void list_employees() { for (int i = 0; i < employees.size(); i += 1) employees[i]->print(); } person * find_employee(string name) { for (int i = 0; i < employees.size(); i += 1) if (employees[i]->fname == name || employees[i]->lname == name) return employees[i]; return NULL; } int main() { add_employee("Mary", "Marlowe", 123456.00, "Management"); add_employee("Dennis", "Dog", 54321.50, "Design"); add_employee("Eric", "Earwig", 34567.75, "Engineering"); add_employee("Tammy", "Teapot", 23500.00, "Tetrahedrons"); add_employee("Francine", "Frogge", 168742.50, "Management"); add_employee("Geoffrey", "Georaffe", 21005.99, "Geography"); add_employee("Lolita", "Lambchop", 25300.00, "Lighting"); add_employee("Indiana", "Impediment", 1500.00, "Intern"); add_employee("Germania", "Gastropod", 47299.99, "Geography"); add_employee("Olivia", "Ointment", 25000000.00, "Owner"); string cmd; while (true) { cout << "> "; cin >> cmd; if (cmd == "list") list_employees(); else if (cmd == "exit") break; else if (cmd == "find") { string n; cin >> n; person * p = find_employee(n); if (p == NULL) cout << "Not founnd\n"; else p->print(); } else if (cmd == "raise") { string n; double pct; cin >> n >> pct; person * p = find_employee(n); if (p == NULL) cout << "Not founnd\n"; else p->salary = p->salary * (1 + pct / 100); } else cout << "command '" << cmd << "' not recognised\n"; } }