// manip.cpp -- Simple uses of IO Manipulators  

#include <iostream>
#include <iomanip>
using namespace std;

int main(void)
{
    int x = 7;
    int y = 354;
    double u = 31.675;
    double w = 3;

    cout << "12345678901234567890\n"; // To help count spaces!
    cout << setw(6) << x << endl;
    cout << setw(8) << y << endl;
    cout << "w = 3 = " << setiosflags(ios::showpoint) << w << endl;
    cout << "u = " << setiosflags(ios::scientific) << u << " = " 
	 << setiosflags(ios::fixed) << u << endl; 
    cout << "u = " << setprecision(3) << u << endl; // Default is 6
    for(int k = 5; k < 15; k++)
    {
        cout << '>' << setw(4) << k << '<' << setw(1) << k << '<' << endl;
    }
    cout << '|' << setw(10) << "rose" << '|' << setiosflags(ios::left) 
	 << setw(10) << "rose" << "|\n"; //by default strings are right aligned
    return 0;
}
/* Here is the output of this program:
12345678901234567890
     7
     354
w = 3 = 3.00000
u = 3.167500e+01 = 31.6750
u = 31.7
>   5<5<
>   6<6<
>   7<7<
>   8<8<
>   9<9<
>  10<10<
>  11<11<
>  12<12<
>  13<13<
>  14<14<
|      rose|rose      |
 */
