c++ cout hex values? - Stack Overflow
I understand this isn't what OP asked for, but I still think it is worth to point out how to do it with printf. I almost always prefer using it over std::cout (even with no previous C background). printf("%.2X", a); '2' defines the precision, 'X' or 'x' d...