I know this is a bit of weird question but please bear with me....
I am using setw to output my details nicely and it looks somewhat like this
1 name goodman
2 another name anothergoodman
3 again a name again a good guy
|
But I want the
setw
to set it towards right somewhat like this
1 name goodman
2 another name anothergoodman
3 again a name again a good guy
|
What shall I do?
Last edited on
Last edited on
I am confused: The top example has the fields shifted to the right; while the bottom example has them shifted to the left. Please try again.
add in the setw() argument the sum of difference you want between the words of a line and the length of the string
the default flag for output is right so the output is padded to the field width by inserting fill characters at the beginning of the line