-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSystem.cpp
109 lines (103 loc) · 2.89 KB
/
System.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include"System.h"
void System::insert_employee(){
int choise;
cout << "Choose employee's type : " << endl;
cout << "1 . Experience\n2. Fresher\n3. Intern\n4. Exit" << endl;
cout << "Enter : " << flush;
cin >> choise;
switch (choise)
{
case 1:
{
system("cls");
Employee* e = new Experience;
e->insert();
Employees.insert(pair<int,Employee*>(e->get_ID(), e));
cout << "\nComplete insert employee information ! \n" << endl;
system("pause");
system("cls");
}
break;
case 2:
{
system("cls");
Employee* e = new Fresher;
e->insert();
Employees.insert(pair<int,Employee*>(e->get_ID(), e));
cout << "\nComplete insert employee information ! \n" << endl;
system("pause");
system("cls");
}
break;
case 3:
{
system("cls");
Employee* e = new Intern;
e->insert();
Employees.insert(pair<int,Employee*>(e->get_ID(), e));
cout << "\nComplete insert employee information ! \n" << endl;
system("pause");
system("cls");
}
break;
default:
break;
}
}
void System::Modify_info(){
int ID_need, choise;
system("cls");
cout << "Enter employee's ID : " << flush;
cin >> ID_need;
system("cls");
if(Employees.find(ID_need)->first == ID_need){
cout << "1. Modify employee\n2. Delete employee" << endl;
cout << "Enter : " << flush;
cin >> choise;
if(choise == 1) {
Employees.at(ID_need)->insert(); // or Employees.find(ID_need)->second->insert()
cout << "\nCompelte modify info employee!\n" << endl;
}
if(choise == 2) {
Employees.erase(Employees.find(ID_need));
cout << "\nCompelte delete info employee!\n" << endl;
}
}else{
cout << "\nCan't find this ID !\n" << endl;
}
system("pause");
system("cls");
}
void System::find_Experience(){
system("cls");
for(auto itr_ex = Employees.begin(); itr_ex != Employees.end(); itr_ex++){
if(itr_ex->second->get_type() == 0){
itr_ex->second->showMe();
}
}
system("pause");
system("cls");
}
void System::find_Fresher(){
system("cls");
for(auto itr_ex = Employees.begin(); itr_ex != Employees.end(); itr_ex++){
if(itr_ex->second->get_type() == 1){
itr_ex->second->showMe();
}
}
system("pause");
system("cls");
}
void System::find_Intern(){
system("cls");
for(auto itr_ex = Employees.begin(); itr_ex != Employees.end(); itr_ex++){
if(itr_ex->second->get_type() == 2){
itr_ex->second->showMe();
}
}
system("pause");
system("cls");
}
void System::Quit(){
exit(0);
}