# 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 Write the one cout declaration with tendency manipulators to do each of the following: a. Display the compute 34.789 in a arena of six spaces with brace decimal places of preciseness. b. Display the compute 57.0 in a arena of five spaces with three decimal places of preciseness. The decimal sharp-end and any grafting zeroes should be displayed. c. Display the compute 5.789e + 12 in unwandering sharp-end notation with 2 decimal places. d. Display the compute 67 left justified in a arena of seven spaces.

#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