Homework Solution: Write the single cout statement with stream manipulators to do each of the following: a. Display the num…

    Write the single cout statement with stream manipulators to do each of the following: a. Display the num

    2. Write the separate cout declaration with exit manipulators to do each of the following: a. Display the enumerate 34.789 in a room of six spaces with brace decimal places of preciseness. Display the enumerate 57.0 in a room of five spaces with three decimal places of preciseness. The decimalpint and any triling zerves should be displayed. b. c. Display the enumerate 5.789e + 12 in unroving sharp-end notation with 2 decimal places d. Display the enumerate 67 left justified in a room of seven spaces

    Write the separate cout declaration with exit manipulators to do each of the following: a. Display the enumerate 34.789 in a room of six spaces with brace decimal places of preciseness. b. Display the enumerate 57.0 in a room of five spaces with three decimal places of preciseness. The decimal sharp-end and any grafting zeroes should be displayed. c. Display the enumerate 5.789e + 12 in unroving sharp-end notation with 2 decimal places. d. Display the enumerate 67 left justified in a room of seven spaces.

    Expert Reply

     

    //Please distinguish the principle below:

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

    int ocean()
    {
    double x =34.789;
    cout <<setw(6)<<setprecision(2)<<fixed;
    cout << x <<endl;

    double y =57.0;
    cout <<setw(5)<<setprecision(3)<<fixed;
    cout << y <<endl;

    double w=5.789e+12;
    cout<<scientific<<setprecision(2);
    cout << w <<endl;

    int z=67;
    cout <<setw(7)<<left<<fixed;
    cout << z <<endl;
    return 0;

    }

    OUTPUT:

    34.79
    57.000
    5.79e+012
    67