/
StaffMainScreen.cpp
64 lines (58 loc) · 1.57 KB
/
StaffMainScreen.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
#include "StaffList.h"
//Starting screen for users
//Display lines:
//1. Search.
//2. Change staff info.
//3. Remove staff member.
//4. Add a staff member.
//0. Exit.
//Enter a number:
////////////////////
//When user input, do the respective functions:
//'1': mainSearch()
//'2': changeStaffInfo()
//'3': removeStaff()
//'4': addStaff()
//Otherwise: print "Invalid command", ask for other input.
void StaffList::mainScreen() {
//readFile(input_text_file, usth_staff_list, stu_list_size);
//StaffList l("USTH_staff_list.txt");
for(;;) {
cout << endl << endl;
cout << "USTHStaffManager v7.0" << endl;
cout << "1. Search." << endl;
cout << "2. Change staff member info." << endl;
cout << "3. Remove staff member." << endl;
cout << "4. Add a staff member." << endl;
cout << "0. Back." << endl;
cout << "What do you want to do, choose one option: ";
// Verify a command if it is integer and belong to {0..4}
int command;
while (true) {
cin >> command;
if (cin && (command < 5) && (command > -1)) break;
cout << "Invalid command!" << endl;
cin.clear();
cin.ignore(256,'\n');
}
//////////////////////////////////////////////////////////
switch (command) {
case 1: mainSearch();
break;
//mainScreen();
case 2: mainChangeStaffInfo();
//mainScreen();
break;
case 3: mainRemoveStaff();
//mainScreen();
break;
case 4: mainAddStaff();
//mainScreen();
break;
case 0: return;
default:
cout << "Invalid command!" << endl;
mainScreen();
}
}
}