C++ examples for Language Basics:Console
Illustrates various integer width cout modifiers, setw
#include <iostream> #include <iomanip> using namespace std; int main()/*from www. j a va 2s .c o m*/ { cout << 456 << 456 << 456 << "\n"; cout << setw(5) << 456 << setw(5) << 456 << setw(5) << 456 << "\n"; cout << setw(7) << 456 << setw(7) << 456 << setw(7) << 456 << " \n"; return 0; }