Displaying text in correct column

Posted by wrongusername on Stack Overflow See other posts from Stack Overflow or by wrongusername
Published on 2010-03-12T22:20:53Z Indexed on 2010/03/12 22:37 UTC
Read the original article Hit count: 114

Filed under:
|
|
|

After getting a helpful answer here, I have run into yet another problem: displaying two or more strings in the column I want it to be displayed in. For an example of the problem I have, I want this output:

Come here! where?             not here!

but instead get

Come here!                     where? not here!

when I use the code

cout << left << setw(30) << "Come here!" << " where? " << setw(20) << "not here!" << endl;

I made sure (I think) that the width of both columns could contain the two strings, but no matter how large I set the width of the columns to be, the error is still there.

© Stack Overflow or respective owner

Related posts about c++

Related posts about cout