-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquiz.cpp
More file actions
54 lines (52 loc) · 1.64 KB
/
Copy pathquiz.cpp
File metadata and controls
54 lines (52 loc) · 1.64 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
#include <iostream>
#include <string>
using namespace std;
int main() {
int choice;
bool login = false;
string loginuser, loginpass, user, pass, confirm;
while (!login) {
cout << "\n--MENU--" << endl;
cout << "1. Sign up" << endl;
cout << "2. Login" << endl;
cout << "3. Exit" << endl;
cout << "Select Choice: ";
cin >> choice;
cin.ignore();
if (choice == 1) {
cout << "Create Username: ";
getline(cin, user);
cout << "Create Password: ";
getline(cin, pass);
while (pass != confirm) {
cout << "Confirm Password: ";
cin >> confirm;
if(pass!= confirm) {
cout << "\nPassword don't match enter pass again!\n";
}
}
} else if (choice == 2) {
cout << "Login user: ";
getline(cin, loginuser);
while (loginpass != pass && loginuser == user) {
cout << "Login pass: ";
getline(cin, loginpass);
if(loginpass!= pass) {
cout << "\nPassword don't match enter pass again!\n";
}
}
if(loginuser != user) {
cout << "user don't match try again!";
}
if (loginuser == user && loginpass == pass) {
login = true;
cout << "Welcome user: " << loginuser;
break;
}
} else if (choice == 3) {
cout << "Exited";
break;
}
}
return 0;
}