0

I am having trouble formatting my output of decimal to binary conversions in the format of XXXX XXXX and XX for hexadecimal using numbers 0 to 300. Does anyone have any ideas? Thanks in advance. Here is a copy of my output.


DECIMAL BINARY HEXADECIMAL
0 0 0
1 1 1
2 10 2
3 11 3
4 100 4
5 101 5
6 110 6
7 111 7
8 1000 8
9 1001 9
10 1010 a
11 1011 b

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by Salem
0

I am having trouble formatting my output of decimal to binary conversions...

Wouldn't it be beneficial to let us know what kind of problem you are having? The output you posted is correct.

0

Oh, was the problem just one of adjusting the widths of the outputs - I mis-read it then.

Assuming cout, look up the setw() IO manipulator.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.