Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have tried writing a C++ program to output the following and follows these gui

ID: 3786959 • Letter: I

Question

I have tried writing a C++ program to output the following and follows these guidelines. I was able to successfully output the first 3 however, I'm having trouble getting the rest.

Objectives: using the iomanip library to format screen output.

Complete the provided main() program with statements to accomplish each of the following. In each case you must use the appropriate I/O stream manipulators to produce the appropriate output wherever possible. Refer to the sample output below as a guide for proper output alignment.

Output first first as an integer value, followed by a space, then in its written form.

Output second as a base ten value, followed by a space, then as a hexadecimal value, followed by a space, then as an octal value. Make sure the appropriate base indicator prefix is shown in the output.

Output third.

Output fourth with four digits, with the sign shown at the left, and the value right aligned. The decimal point must also appear.

Output fourth with four significant figures.

Output fifth with seven significant figures. (Note: use left alignment here)

Output fifth with three digits to the right of the decimal point.

Output third.

Output fourth with two digits to the right of the decimal point.

Output sixth with no decimal portion showing

Output fourth with eight digits to the right of the decimal point.

Output sixth with six digits.

You must start your coding by using exactly the following program. You may not modify it, except to add the required code between the Solution starts, and Solution ends comments.

Here is what the output should look like:

SAMPLE PROGRAM OUTPUT (assume user inputs values shown in bold). This is meant to give you a feel for what your output should look like, but your program must work correctly with the test driver for every run.

Explanation / Answer

#include <iostream>
#include <iomanip>
using namespace std;
int
main()
{
bool first;
int second;
long third;
float fourth;
float fifth;
double sixth;
/*
I am doing the coding from 3rd onward,as you have already done upto 3.
*/
cout << "Enter bool, int, long, float, float, and double values: ";
cin >> first >> second >> third >> fourth >> fifth >> sixth;
cin>>sixth;
cout << endl;

   cout<<"+"<<" " << fixed << setprecision(0) << fourth<<"."<<endl; //4th
//   cout<<" "<<
   std::cout << " "<<setprecision(4) << std::scientific<<fourth<<endl; // scientific of iomanip is used to get the exponential form of float
   std::cout << left<< setw(10)<<setprecision(7) << std::scientific<<fifth<<endl;
cout <<" "<< fixed << setprecision(3) << fifth<<endl;
cout<<third<<endl;
cout<<" " << fixed << setprecision(2) << fourth<<endl;
cout<<" " << fixed << setprecision(0) << sixth<<endl;
cout<<"" << fixed << setprecision(8) << sixth<<endl;
cout<<" " << fixed << setprecision(2) << sixth<<endl;
cin.get();
return 0;
}