-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserLogin.cpp
49 lines (43 loc) · 1.5 KB
/
UserLogin.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
#include <iostream>
#include <limits>
#include <fstream>
#include "functions.h"
using namespace std;
int main() {
int choice;
cout << "1. Register\n2. Login\n3. Update Password\n4. Delete File\n5. Exit" << endl << "Enter your choice: ";
while (true) {
try {
cin >> choice;
if (cin.fail()) {
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), '\n');
throw invalid_argument("Invalid choice. Please enter a valid number.");
}
switch (choice) {
case 1:
registerUser();
break;
case 2:
loginUser();
break;
case 3:
updatePassword();
break;
case 4:
deleteFile();
break;
case 5:
cout << "Thank you for using the program. Goodbye!" << endl;
return 0;
default:
throw invalid_argument("Invalid choice. Please enter a valid number.");
}
} catch (const invalid_argument& e) {
cout << e.what() << endl;
}
cout << "1. Register\n2. Login\n3. Update Password\n4. Delete File\n5. Exit" << endl << "Enter your choice: ";
}
cout << "Thank you for using the program. Goodbye!" << endl;
return 0;
}