setw from left o_O

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.
closed account (E3h7X9L8)
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
@leryss
leryss wrote:
add in the setw() argument the sum of difference you want between the words of a line and the length of the string


Didn't got that one. could you please give me a link/example?


EDIT:- edited title from setw from right to setw from left... (I am getting confused with left and right :D )
Topic archived. No new replies allowed.