0

I was just wondering how to align data like this:

McBride, Susan        $ 1000.00        $ 95.00    5
O'Hara, Catherine        $ 2500.00        $ 299.51    5

To make it look like this:

McBride, Susan        $ 1000.00 $    95.00        5
O'Hara, Catherine    $ 2500.00 $  299.51        5

The second part was done by my professor as an example, just like how i would align the numbers to the right like that and to just make it look neat. I've been trying for ever just to try and make my output look presentable.

5
Contributors
5
Replies
6
Views
10 Years
Discussion Span
Last Post by Ancient Dragon
0

Hmm... both examples look exactly the same, because the whitespace doesn't show correctly in HTML. The only way you can make whitespace show is by using [code]

[/code] tags, so you might want to try that to show us better.

In any case, just try using lots of cout.setw() , cout << left , right , and center to align everything (shouldn't be too hard). Just experiment lots.

0

It doesn't really matter what the file looks like -- how it appears on the screen is a function of the program that displays it. And different programs might display it differently. Font name and font size both influence greatly how the file will look on your monitor.

0

I may get grief from C++ afficianados but printf() makes it very easy to align data into columns. And it is C++.

0

I may get grief from C++ afficianados but printf() makes it very easy to align data into columns. And it is C++.

No grief from me:eek: formatting text using printf() is a lot easier than with cout. I never could remember all thouse wiers functions such as setw().

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.