how to input char with space
I already write a C++ code like below, when i run it, it will end after show: cout<<"Emplyer account"<<endl; cout<<"Register New Employee : "; how to type the code to can enter the char with space to register the new employee name. //username is admin //password is admin #include <iostream> #include <iomanip> #include <conio.h> using namespace std; int main() { string username, password ; int x; cout<<"1 = login 2 = Exit"<<endl; cin>>x; if (x==1) { cout<<"Please enter your username: "<<endl; cin>>username; cout<<"Please enter your password: "<<endl; cin>>password; if (password == "admin" && username == "admin" || password =="ADMIN" && username == "ADMIN") { cout<<"Emplyer account"<<endl; cout<<"Register New Employee : "; char name[100]; cin.getline(name,sizeof(name)); cout<<name; } else if (password == "user" && username == "user" || password == "USER" && password == "USER") { cout<<"Emplyee account"<<endl; } else {cout<<"User or password error"; cout<<"\n"; main();} } else if(x==2) cout<<"Exit"; return 0; }