0

I want to have my output as 0a instead of a within one line of cout code, how should I do that. many thanks

#include <iostream>    

int main () {
  uint8_t n = 10;

  std::cout <<std::hex<< + static_cast<uint8_t>(n)<<'\n';
  return 0;
}
drescherjm
  • 9,653
  • 5
  • 43
  • 62
nnnn9
  • 1
  • 2
    [Printing zero-padded hex with std::cout](https://stackoverflow.com/questions/21416425/printing-zero-padded-hex-with-stdcout) might be helpful – raiyan22 Jan 11 '22 at 01:45

0 Answers0