int userin; string name; string firstname; string lastname; string dob; bool exit_b= false; while(exit_b == false){ cout<<"\nmake a new customer enter: 1"<<endl; cout<<"\nmake a new staff enter: 2"<<endl; cin>>userin; if(userin ==1) { cout<<"Enter First Name: "<<endl; cin>>firstname; cout<<"Enter Last Name: "<<endl; cin>>lastname; name = firstname + " " + lastname; cout<<"Date Birth: "<<endl; //this thing should take user input getline(cin,dob); //but this thing doesnt take input it jumps to the next part of the code Customer customer(name, dob, rand()%10000); customer.print_detail(); }
while (getline(cin, dob)) if (dob != "") break; //we got something
getline
cin.sync();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)