<< and >> aren't overloaded for string. Use getline to input it and cout << name.c_str() for output.