• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

C++ String fill question

Steelerz37

Senior member
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
 
First concatenate first and last name. Then set your iosflags and use setw on the full string, not just on part of it.
 
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
 
Back
Top