// main.cpp #include using namespace std; #include "employee.h"???//defines class Employee #include "map_template.h"??//defines template map_template int main(void) { ?typedef unsigned int ID; ???????//Identification number of Employee ?map_template Database;?????//Database of employees ?Database.Add(761028073,Employee("Jan Kowalski","salesman",28)); ?//Add first employee: name: Jan Kowalski, position: salseman, age: 28, ?Database.Add(510212881,Employee("Adam Nowak","storekeeper",54)); ?//Add second employee: name: Adam Nowak, position: storekeeper, age: 54 ?Database.Add(730505129,Employee("Anna Zaradna","secretary",32)); ?//Add third employee: name: Anna Zaradna, position: secretary, age: 32 ?cout << Database << endl;???????//Print databese ?map_template NewDatabase = Database;?//Make a copy of database ?Employee* pE; ?pE = NewDatabase.Find(510212881);?????//Find employee using its ID ?pE->Position = "salesman";???????//Modify the position of employee ?pE = NewDatabase.Find(761028073);?????//Find employee using its ID ?pE->Age = 29;??????????//Modify the age of employee ?Database = NewDatabase;?????? //Update original database ?cout << Database << endl;???????//Print original databese ?return 0; }; // employee.h #include using namespace std; class Employee { public: string Name; string Position; unsigned Age; Employee(string, string, unsigned); Employee(); friend ostream& operator << (ostream&, const Employee&); }; // map_template.h #include #include using namespace std; template struct Rekord { A nr; B wartosc; }; template class map_template { vector> tablica; unsigned wielkosc; public: map_template(); ~map_template() {tablica.clear();} void Add(A, B); B* Find(A); unsigned size() const {return wielkosc;} template friend ostream& operator << (ostream&, const map_template&); }; template map_template::map_template() : wielkosc(0) { tablica.clear(); } template void map_template::Add(A a, B b) { Rekord nowy; nowy.nr = a; nowy.wartosc = b; tablica.push_back(nowy); ++wielkosc; } template B* map_template::Find(A szukana) { B* wskaznik = nullptr; for(unsigned i = 0; i < wielkosc; ++i) { if(tablica[i].nr == szukana) { wskaznik = &(tablica[i].wartosc); return wskaznik; } } return wskaznik; } template ostream& operator << (ostream& out, const map_template& obiekt) { for(unsigned i = 0; i < obiekt.wielkosc; ++i) { out << obiekt.tablica[i].nr << " " << obiekt.tablica[i].wartosc << endl; } return out; } // employee.cpp #include "employee.h" Employee::Employee(string imie, string stanowisko, unsigned wiek) : Name(imie), Position(stanowisko), Age(wiek) {} Employee::Employee() : Name(""), Position(""), Age(0) {} ostream& operator << (ostream& out, const Employee& obiekt) { out << "name: " << obiekt.Name << ", position: " << obiekt.Position << ", age: " << obiekt.Age; return out; }