Answer to Question #58180 in C++ for shantanu more
how to make login page in cpp file handling with following requirements:
1)create new account(create username and password)
2) Login
3)quit
1
2016-03-09T08:36:42-0500
#include <iostream>
#include <map>
using namespace std;
int main() {
map<string, string> list;
int choise;
string username, password;
while (true) {
cout << "1. Create new account\n"
"2. Login\n"
"0. Quit\n";
cin >> choise;
switch(choise) {
case 1:
cout << "\tEnter username: ";
cin >> username;
cout << "\tEnter password: ";
cin.get();
getline(cin, password);
list[username] = password;
cout << "\t User added\n";
break;
case 2:
cout << "\tEnter username: ";
cin >> username;
cout << "\tEnter password: ";
cin.get();
getline(cin, password);
if (list[username] == password)
cout << "\t Hello, " << username << endl;
else
cout << "\t Incorrect username or password!" << endl;
break;
case 0:
cout << "Good bye!" << endl;
return 0;
default:
cout << "Wrong input" << endl;
}
}
return 0;
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C++
Comments
Leave a comment