My c++ program is mentioned below.
int choice;
while(choice!=2){
cin>>choice;
}
string name;
string pass;
cout<<"Username: ";
getline(cin, name);
cout<<"Password: ";
getline(cin, pass);
I want my program to work like until I enter 2, it keeps on asking me input number. And when I enter 2 it prompts me for username and password. Starting program is working fine but the problem is that I have used getline function to take string input but it is asking separate input for username and password. It is only asking input in one line like USERNAME: PASWORD: OUTPUT: