Thursday, November 25, 2010

The setw() Function

When writing to a stream, setting the width property only lasts to the write of the stream.

For example, if you want to put three 4's in a field width of 20, you would do this:
cout << setw(20) << 4 << setw(20) << 4 << setw(20) << endl;

No comments:

Post a Comment