#include <iostream>
#include <string>
#include <map>
using namespace std;
map<string, string> users;
void signUp() {
string username, password;
cout << "Enter username: ";
cin >> username;
cout << "Enter password: ";
cin >> password;
users[username] = password;
cout << "Signed up successfully!" << endl;
}
void signIn() {
string username, password;
cout << "Enter username: ";
cin >> username;
cout << "Enter password: ";
cin >> password;
if (users.find(username) != users.end() && users[username] == password) {
cout << "Sign in successful!" << endl;
} else {
cout << "Invalid username or password!" << endl;
}
}
int main() {
int choice;
while (true) {
cout << "1. Sign Up\n2. Sign In\n3. Exit\nEnter your choice: ";
cin >> choice;
switch (choice) {
case 1:
signUp();
break;
case 2:
signIn();
break;
case 3:
cout << "Exiting...";
return 0;
default:
cout << "Invalid choice. Please try again." << endl;
}
}
return 0;
}