-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestmap.cpp
29 lines (21 loc) · 1.25 KB
/
testmap.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
using namespace std;
#include "employee.h" //defines class Employee
#include "map_template.h" //defines template map_template<Key,Value>
int main(void)
{
typedef unsigned int ID; //Identification number of Employee
map_template<ID,Employee> 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<ID,Employee> 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
}