hex stores into a variable ?

How do i store hex value in a variable ?

Like this ;

1
2
3
4
5

int show = 1; 

int hex = 0x2; // something like that ! 
Yes, that looks ok.
But it does not show 0C when i try to Print out using std::cout.

Thanks
1
2
3
#include <iomanip>
// ...
std::cout << std::hex << hex;
Last edited on
Topic archived. No new replies allowed.