Simple string variable - C++ Data Type

C++ examples for Data Type:char array

Description

Simple string variable

Demo Code

#include <iostream>
using namespace std;
int main()//  w w w.  j a v  a2s  . com
{
   const int MAX = 80;              //max characters in string
   char str[MAX];                   //string variable str
   cout << "Enter a string: ";
   cin >> str;                      //put string in str
   //display string from str
   cout << "You entered: " << str << endl;
   return 0;
}

Result


Related Tutorials