In the following code I have been trying to get it to check for multiple parameters (when checking if the username AND password are correct).
string username;
string password;
cout << "Hello there. To access this program, please put in your user name and password." << endl;
cout << "Username: ";
cin >> username;
cout << "Password: ";
cin >> password;
if(username != "admin", password != "therealpassword"){
do{
cout << "Username or password is incorrect." << endl;
cout << "Username: ";
cin >> username;
cout << "Password: ";
cin >> password;
}while(username != "admin", password != "therealpassword");
}
For whatever reason, when running the program and I put in the incorrect username, but the correct password, it allows me to login. At the (do...while) section, if I put in the wrong username, but the right password again, I am able to login correctly still, even though the username is incorrect. How can I get this to check for both the username and password? Any and all help is appreciated.