103 login system

 avatar
unknown
plain_text
2 years ago
1.3 kB
10
Indexable
string username, password;
    cout << "Enter a username: ";
    cin >> username;
    cout << "Enter a password: ";
    cin >> password;
    userPasswords[username] = password;
    cout << "User registered successfully!" << endl;
   
---------------------------------------------

string username, password;
    cout << "Enter a username: ";
    cin >> username;
    cout << "Enter a password: ";
    cin >> password;
    driverPasswords[username] = password;
    cout << "Driver registered successfully!" << endl;
    
-----------------------------------------------

string username, password;
    cout << "Enter a username: ";
    cin >> username;
    cout << "Enter a password: ";
    cin >> password;
    if (userPasswords.count(username) && userPasswords[username] == password) {
        cout << "User logged in successfully!" << endl;
        // Add the rest of the options in the main menu here
    } else if (driverPasswords.count(username) && driverPasswords[username] == password) {
        cout << "Driver logged in successfully!" << endl;
        // Add the rest of the options in the main menu here
    } else {
        cout << "Login failed! Incorrect username or password." << endl;
    }
    



Editor is loading...