Thursday 11 February 2016

How could you use C++ to find out which character the code 88 represents?Come up with at least two ways.

Leave a Comment
Ans:

Here are four ways:
char c = 88;
cout << c << endl;          // char type prints as character
cout.put(char(88));         // put() prints char as character
cout << char(88) << endl;    // new-style type cast value to char
cout << (char)88 << endl;    // old-style type cast value to char


Reference:

Answers to Chapter Reviews C++ Primer Plus

If You Enjoyed This, Take 5 Seconds To Share It

0 Questions: