Category Archive
The following is a list of all entries from the Programming category.
Weird Hex Output
Filed in Programming, October 4, 2007, 10:59 amIn C++, to output and integer in hex, I’d been taught to do this:
1
cout << hex << an_integer;
And if I want to show “0x” before the value, I need to do the following:
1
2
cout.setf(ios::showbase);
cout << hex << an_integer;
The above code works well for either positive or negative integers, but not the value ZERO. If I run [...]