Is there a way to make setw and setfill pad the end of a string instead of the front?
I have a situation where I'm printing something like this.
CONSTANT TEXT variablesizeName1 .....:number1 CONSTANT TEXT varsizeName2 ..........:number2 I want to add a variable amount of '.' to the end of
"CONSTANT TEXT variablesizeName#" so I can make ":number#" line up on the screen.
Note: I have an array of "variablesizeName#" so I know the widest case.
Or
Should I do it manually by setting setw like this
for( int x= 0; x < ARRAYSIZE; x++) { string temp = string("CONSTANT TEXT ")+variabletext[x]; cout << temp; cout << setw(MAXWIDTH - temp.length) << setfill('.') <<":"; cout << Number<<"\n"; } I guess this would do the job but it feels kind of clunky.
Ideas?