C++ examples for STL:string
Read a line of text into string with getline function
#include <iostream> #include <string> using namespace std; int main()//from w w w. j a v a 2 s . co m { string message; // declare a string object cout << "Enter a string:\n"; getline(cin, message); cout << "The string just entered is:\n" << message << endl; return 0; }