Left-justification and right-justification.
#include <iostream>
#include <iomanip>
using std::cout;
using std::endl;
using std::ios;
using std::setw;
using std::setiosflags;
using std::resetiosflags;
int main()
{
int x = 12345;
cout << "Default is right justified:\n"
<< setw(10) << x << "\n\nUsing Member Functions"
<< "\nUse setf to set ios::left:\n" << setw(10);
return 0;
}
Related examples in the same category