Displaying constants as a decimal/hexadecimal/letter

I need to write a program in which you do the following:

Define three named constants using the appropriate data types:
DEC_NUM = 65;
HEX_NUM = 0x7a;
LETTER = 'f';

Then display each of these constants in decimal, in hexadecimal, and as a character using cout. Your program will have a total of nine cout statements.

Any help would be much appreciated!
Homework is for the beginner subsection...

You define then using #define .

For the char to int, and int to char, use casts ex:<<(char)DEC_NUM<<//..." .

But to convert to hex, do std::cout<<"0x"<<std::hex<<DEC_NUM<<"\n";

And you can just cout the hex number for the int version, and you need to convert your hex to hex to view it as hex.
Topic archived. No new replies allowed.