C++ cin get Reads multiple lines, terminates on '$' character

Description

C++ cin get Reads multiple lines, terminates on '$' character

#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  va  2  s .  c o  m
{
   cout << "\nEnter a string:\n";
   cin.get(str, MAX, '$');           //terminate with $
   cout << "You entered:\n" << str << endl;
   return 0;
}



PreviousNext

Related