How to use getline to get 2 different inputs
So i made basic username and password code and the part of the code where my issue arises is this: cout << "Please enter your username." << endl; getline(cin,username1); getline(cin,username2); cout << "Please enter your password." << endl; getline(cin,password1); getline(cin,password2); This is a portion of my code...i have 2 if statements that ofc is set to check for the username and password. So lets say i have 2 usernames "blah" and "cha" and the password for "blah" is "apple" and for "cha" its "orange". Now when i run my program i cant type either username to where it corresponds to its own password. So if i run it and since username1 appears first in my code it occupies the first line if i wanted to type username2 i would have to press enter first to get to the next line and then type and its the same for the passwords. So im confused as to how i can fix it so i can write username1 or 2 and just press enter once so i can move on to type the password that corresponds with the username i chose. Thanks.