C++ cin get Reads char array
#include <iostream> using namespace std; const int MAX = 2000; //max characters in string char str[MAX]; //string variable str int main()//from w ww. j a v a2 s . c om { cout << "\nEnter a string:\n"; cin.get(str, MAX, '$'); //terminate with $ cout << "You entered:\n" << str << endl; return 0; }