Use cin.getline to read a char array based string
#include <iostream> using namespace std; int main() { char name[25]; cout << "Please enter your name \n"; cin.getline(name,25); cout << "Hello " << name << endl; return 0; }