0

I have a piece of code here:

#include <iostream>
#include <iomanip>
using namespace std;

int main(void)
{
  
  
  unsigned char bytes[] = {0x43,0x4d,0x30,0x30,0x0f,0x0D};
  
  std::cout << std::hex << bytes[0] <<std::endl;
  

}

The above program is printing C to command line. How can I make the program to print 43 to commandline. My OS is Windows 10, 64 bit.

Vinod
  • 4,138
  • 11
  • 49
  • 65

1 Answers1

1

Use printf function:

#include<cstdio>
...
printf("%x", bytes[0]);

See here if you want to know more about printf function.

robbinc91
  • 548
  • 6
  • 14