12
int x=255; printf("%X",x);
1234
#include <iomanip> int x = 255; std::cout << std::hex << x;
123456789
#include <iostream> #include <iomanip> using namespace std; int main(){ int x=255; cout<<"x: "<<x<<"\n x(hex):"<<hex<<x<<endl; system("pause");//to see the outcome }