use a string variable, ie: #include <string> string name; //initialize getline(cin, name); //get input