C++ examples for Data Type:string
Reads string with embedded blanks using cin.get
#include <iostream> using namespace std; int main()/*from w w w . j av a 2 s.co m*/ { const int MAX = 80; //max characters in string char str[MAX]; //string variable str cout << "\nEnter a string: "; cin.get(str, MAX); //put string in str cout << "You entered: " << str << endl; return 0; }