Imprimir dados em HEX usando C ++

#include <iomanip>

for (int i = 0; i < size; ++i)
std
::cout << std::hex << std::setfill('0') << std::setw(2) << (int)data[i] << " ";
std
::cout << std::endl;