C++ cout display the value stored in a character variable

Description

C++ cout display the value stored in a character variable

#include <iostream>
using namespace std;
int main()/*from  w w w.ja v a2  s. com*/
{
   char ch;     // this declares a character variable
   ch = 'a';    // store the letter a in ch
   cout << "The character stored in ch is " << ch << endl;
   ch = 'm';    // now store the letter m in ch
   cout << "The character now stored in ch is "<< ch << endl;
   return 0;
}



PreviousNext

Related