acidzombie24 acidzombie24 - 1 year ago 192
C++ Question

c++ cout hex values?

I want to do:

int a = 255;
cout << a;

and have it show FF in the output, how would i do this?

Answer Source


#include <iomanip>


std::cout << std::hex << a;

There are many other options to control the exact formatting of the output number, such as leading zeros and upper/lower case.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download