I'm familiar with formatting with iomanip, but my output is horrendous.
Because the data (like city, name , etc ) are all different word lengths, it does not output nicely.
Any tips to make this look nice? In that sense, everything should be in its own column.
Thanks in advance!
How to nicely format contents of array
Page 1 of 15 Replies - 163 Views - Last Post: 28 January 2013 - 12:34 PM
Replies To: How to nicely format contents of array
#2
Re: How to nicely format contents of array
Posted 26 January 2013 - 04:23 PM
#3
Re: How to nicely format contents of array
Posted 26 January 2013 - 04:48 PM
If you are familiar with the functions in the iomanip header you should be able to format the output into columns using these functions. You may want to read up on the setw() function.
Jim
Jim
#4
Re: How to nicely format contents of array
Posted 27 January 2013 - 09:41 PM
I did. Part of the problem is that only 2 or 3 lines dont line up with the column. It's iterates through a for loop, so I am just having trouble thinking of a way to make it all line up nicely. I have setw's '\t's and so on, but those three lines just dont want to adjust.
#5
Re: How to nicely format contents of array
Posted 28 January 2013 - 12:03 AM
I wouldn't use tabs. Just find out how much space each column needs.
With titles you might need two lines.
cout << setw(20) << column_a
<< setw(15) << column_b
<< setw(20) << column_c
<< setw(10) << column_d
<< endl;
With titles you might need two lines.
Amount Date Date
Due Received
------------------------
#6
Re: How to nicely format contents of array
Posted 28 January 2013 - 12:34 PM
I was initially going to do it like that but the for loop saved time because alot of data is being read in from a file. Thank you though!
/>
This post has been edited by Nela12: 28 January 2013 - 12:35 PM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|