How to output character variables using cout in C++?

In C++, you can use the cout statement to output character variables. Specifically, the syntax is:

char ch = 'A';
cout << ch << endl;

In the code above, a character variable ch is first defined and assigned the value ‘A’, then the cout statement is used to output the character variable to the screen. The << is the output operator, used to insert the character variable into the stream for output. Finally, endl is the newline character, used for line break output.

bannerAds