-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmain.cpp
More file actions
87 lines (82 loc) · 2.32 KB
/
main.cpp
File metadata and controls
87 lines (82 loc) · 2.32 KB
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
#include <bits/stdc++.h>
#include "ComplaintBox.h"
using namespace std;
int main() {
ComplaintBox cb;
string choice;
int choiceNum = 0;
do {
cout << BOLDVIOLET << "\n==== Complaint Box Menu ====\n" << RESET;
cout << CYAN << "1. Register User\n"
<< "2. Register Admin\n"
<< "3. User Login\n"
<< "4. Admin Login\n"
<< "5. File Complaint\n"
<< "6. Export Complaints to CSV\n"
<< "7. Search Complaints\n"
<< "8. Exit\n" << RESET;
cout << WHITE << "Choice: " << RESET;
cin >> choice;
// <<<<<<< Fix/crash-main-menu
try {
choiceNum = stoi(choice);
switch (choiceNum)
{
case 1:
cb.registerUser();
break;
case 2:
cb.registerUser(true);
break;
case 3:
cb.loginUser();
break;
case 4:
cb.loginUser(true);
break;
case 5:
cb.fileComplaint();
break;
case 6:
cout << "Exiting..." << endl;
break;
default:
cout << "Invalid choice!\n";
}
} catch (exception& e) { // stoi throw an exception when input is non-numeric string
cout << "Invalid input! Please enter a number."<<endl;
}
}while (choiceNum != 6);
// =======
// switch (choice) {
// case 1:
// cb.registerUser();
// break;
// case 2:
// cb.registerUser(true);
// break;
// case 3:
// cb.loginUser();
// break;
// case 4:
// cb.loginUser(true);
// break;
// case 5:
// cb.fileComplaint();
// break;
// case 6:
// cb.exportComplaintsToCSV();
// break;
// case 7:
// cb.searchComplaints();
// break;
// case 8:
// cout << BOLDGREEN << "Exiting..." << RESET << endl;
// break;
// default:
// cout << BOLDRED << "Invalid choice!\n" << RESET;
// }
// } while (choice != 8);
// >>>>>>> main
return 0;
}