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