Hey everyone,
I'm slowly working my way through "Jumping into C++" but can't seem to get passed this practice problem of creating multiple users and passwords (this is at p. 75 in the book, practice problem number 4). Right now I'm stuck trying to make it so two users, each with their own seperate password can log in, but only "user_1" and "password_1" seems to work.
Could anyone please tell me what I'm doing wrong here?
Thanks.
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string user_1;
string user_2;
string password_1;
string password_2;
cout << "Enter username " << endl;
getline (cin, user_1, '\n' ) || (cin, user_2, '\n');
cout << "Enter password" << endl;
getline (cin, password_1, '\n' ) || (cin, password_2, '\n');
if (user_1 == "diddy" && password_1 == "kiddy")
{
cout << "Welcome diddy! " << endl;
}
else if (user_2 == "daddy" && password_2 == "kaddy")
{
cout << "Welcome daddy! " << endl;
}
else
{
cout << "Wrong! Imposter!! " << endl;
}
}