Listing 8 Sets the output field width setw()

// adjust.cpp: Justify output
#include <iostream.h>
#include <iomanip.h>

main()
{
   cout << '|' << setw(10) << "hello" << '|' << endl;

   cout.setf(ios::left,ios::adjustfield);
   cout << '|' << setw(10) << "hello" << '|' << endl;

   cout.fill('#');
   cout << '|' << setw(10) << "hello" << '|' << endl;
   return 0;
}

//Output
//|     hello|
//|hello     |
//|hello#####|

// End of File