-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmain.cpp
More file actions
101 lines (95 loc) · 4.61 KB
/
main.cpp
File metadata and controls
101 lines (95 loc) · 4.61 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <bits/stdc++.h>
#include "ComplaintBox.h"
using namespace std;
int main() {
ComplaintBox cb;
string choice;
int choiceNum = 0;
do {
// Double-line box top
cout << BOLDVIOLET << u8"╔════════════════════════════════════════════════════╗\n";
cout << u8"║ 🗂️ COMPLAINT BOX MENU ║\n";
cout << u8"╠════════════════════════════════════════════════════╣\n";
// Menu options with dividers
cout << u8"║ 1. Register as User ║\n";
cout << u8"╟────────────────────────────────────────────────────╢\n";
cout << u8"║ 2. Register as Admin ║\n";
cout << u8"╟────────────────────────────────────────────────────╢\n";
cout << u8"║ 3. Login as User ║\n";
cout << u8"╟────────────────────────────────────────────────────╢\n";
cout << u8"║ 4. Login as Admin ║\n";
cout << u8"╟────────────────────────────────────────────────────╢\n";
cout << u8"║ 5. File a Complaint ║\n";
cout << u8"╟────────────────────────────────────────────────────╢\n";
cout << u8"║ 6. Export Complaints to CSV ║\n";
cout << u8"╟────────────────────────────────────────────────────╢\n";
cout << u8"║ 7. Search Complaints ║\n";
cout << u8"╟────────────────────────────────────────────────────╢\n";
cout << u8"║ 8. Exit ║\n";
cout << u8"╚════════════════════════════════════════════════════╝\n" << RESET;
// Input prompt
cout << WHITE << "\n👉 Enter your choice (1-8): " << 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;
}