width

Syntax:

    #include <fstream>
    int width();
    int width( int w );

The function width() returns the current width, which is defined as the minimum number of characters to display with each output. The optional argument w can be used to set the width. For example:

     cout.width( 5 );
     cout << "2";

displays

         2

(that's four spaces followed by a '2')

Related Topics: fill, precision