//--- Print hex with leading zeros of the decimal value n for (int i=2*sizeof(int) - 1; i>=0; i--) cout << "0123456789ABCDEF"[((n >> i*4) & 0xF)];