Discussion:
A4Q1 - Print formatting
(too old to reply)
THOM BOHK
2011-06-27 21:42:39 UTC
Permalink
I believe my utf8 program to be fully operational, but there's still
one thing that I can't reproduce from the sample output:

on the last line of output, the sample program gives

0x01 : valid value 0x1

my program gives

0x1 : valid value 0x1

The cast we use to print the value of the character in hex prints
without any leading zeros. How do we restore leading zero so that I
can make my output match the sample program's? Nothing I tried from i/
o formatting works..
Alex Walter
2011-06-27 21:57:30 UTC
Permalink
Post by THOM BOHK
I believe my utf8 program to be fully operational, but there's still
on the last line of output, the sample program gives
0x01 : valid value 0x1
my program gives
0x1 : valid value 0x1
The cast we use to print the value of the character in hex prints
without any leading zeros. How do we restore leading zero so that I
can make my output match the sample program's? Nothing I tried from i/
o formatting works..
Take another look at iomanip. There's two manipulators that you need to
use to accomplish this.

Loading...