C++ cin get Reads string with embedded blanks

Description

C++ cin get Reads string with embedded blanks

#include <iostream>
using namespace std;
int main()/*  www  .ja v  a  2s  .  c  o 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;
}



PreviousNext

Related