The eBay Song | Per Insurance | Song Lyrics | Gómez PEER | MPAA
formatting output... [Archive] - PCMech Forums

PDA

View Full Version : formatting output...


GSXdan
11-25-2003, 11:06 AM
How do you format the output so it all lines up perfectly? I am using iomanip and i have setw(15), but it still doesnt line up correctly.


cout << setw(15) << player[x]->getcash() << endl;


stil gives me this:


*******************************
Sam 1500
Mary 1000
Pete 500
Sue 500

McDonald Hall unowned
Commons Eatery unowned
Darrow Hall unowned
Bromfield Hall unowned
Keeper Eatery unowned
Founders Hall unowned
Offenhauer Hall unowned
The Nest Eatery unowned
Dunbar Hall unowned
Compton Hall unowned
Sundial Eatery unowned
Anderson Hall unowned
*******************************

doctorgonzo
11-25-2003, 11:20 AM
I've never used iomanip or setw. I generally just use tabs, like this:

cout << "\t\t\t" << player[x]->getcash() << endl;

where \t is the tab character. It will line up much better.

If you want to use setw, it looks like you will have to set the width to a number that takes into account the length of the person's name.

GSXdan
11-25-2003, 11:44 AM
thanks, that was a lot easier than using iomanip!

thanks again ^dan

HNPFL
11-30-2003, 11:18 PM
Wow the game sounds cool what is it about?