C++ examples for Data Type:char
Illustrates this declaration and the use of cout to display the value stored in a character variable.
#include <iostream> using namespace std; int main()//from ww w.ja v a 2s. co m { 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; }