C++ String fill question

Steelerz37

Senior member
Feb 15, 2003
693
0
0
I am writing a program the reads a data file and prints out reports of the file. The problem that I am having is that I have 2 strings, firstName and lastName. They are printed out in this order:

lastName, firstName

after the firstName I am also printing out a balanceOwed variable. The problem is that I can not get my balanceOwed variables to line up neatly in a column and I am not sure what I need to do. I have tried the setw() on the firstName but I am sure the problem is with the lastName being different lengths, I just am not sure how to deal with that. Thanks.


Ben
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
First concatenate first and last name. Then set your iosflags and use setw on the full string, not just on part of it.
 

Steelerz37

Senior member
Feb 15, 2003
693
0
0
thanks!! I've been sitting here just thinking about it the wrong way. Read that and got it fixed in just a few minutes. Thanks.


Ben