//you can use std::hex to change the format of cout //don't forget the std::dec at the end to get the cout back to normal int a = 255; std::cout << std::hex << a << std::dec << ' ';