question about setw();

I'm trying to figure out the details to setw(). One thing is that if I were to store a string into a string variable and then try to setw() before it it won't happen. I'm sure there's a reason it won't, but is there a work around? For instance:

string myString = "This is my string
";
int i;
i = myString.lenth();
cout << setw(i+10) << myString;

If memory serves, setw() only works w/ integer and string types. Is this correct? I assume it doesn't work w/ string variables, unless I'm doing something wrong.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories