ios::width vs.< iomanip> setw()

I wanted to know if when formatting output if there is a preference between iso::width from the <iostream> header and setw() in the <iomanip> header? If there is a preference or reason to use one over the other please explain why.

Thanks in advance,
pxm76
If multiple output values are to be formatted, each with its own width, using the manipulator makes the code more readable.

cout << setw(25) << name << setw(12) << phone << setw(4) << age << '\n' ;

That makes sense. Thanks for the reply!
Topic archived. No new replies allowed.