// main.cpp #pragma warning(disable: 4786) #include #include #include #include #include #include using namespace std; #include "Employee.h" #include "HourlyEmployee.h" #include "SalariedEmployee.h" void EmpmapPrint(const map S, ostream& Out); void main() { SalariedEmployee Ben("Ben", "Keller", "000-00-0000", 12000.0); SalariedEmployee Bill("Bill", "McQuain", "111-11-1111", 13000.0); SalariedEmployee Dwight("Dwight", "Barnette", "888-88-8888", 9000.0); HourlyEmployee Jack("Jack", "Frost", "000-00-0001", 9.75, 37); map S; S.insert(pair(Bill.getID(), &Bill)); S.insert(pair(Dwight.getID(), &Dwight)); S.insert(pair(Ben.getID(), &Ben)); S.insert(pair(Jack.getID(), &Jack)); EmpmapPrint(S, cout); map::const_iterator It; It = S.find("000-00-0001"); cout << (*It).second->getName() << endl; cout << (*It).second->getHours() << endl; HourlyEmployee Fred("Fred", "Flintstone", "888-88-8888", 10.25, 40); HourlyEmployee Homer("Homer", "Simpson", "123-45-6789", 9.99, 12); S[Fred.getID()] = &Fred; S[Homer.getID()] = &Homer; EmpmapPrint(S, cout); It = S.find("000-00-0000"); if (It != S.end()) cout << (*It).second->getName() << endl; It = S.find("000-00-0001"); if (It != S.end()) cout << (*It).second->getName() << endl; } void EmpmapPrint(const map S, ostream& Out) { int Count; map::const_iterator It; for (It = S.begin(), Count = 0; It != S.end(); It++, Count++) { (*It).second->Print(cout); } }