quiz2a - setprecision & setw

Name ________________________________     Date _________

Determine the output.  Show your work.

#include <iostream.h> //cin and cout
#include <iomanip.h> // setw , setprecision, unsetf

main()
{
int x = 754;
float p = 3.141562;
cout.setf(ios::showpoint);//activating decimal display

//Use boxes for each character output.
cout <<setw(5) << "##" << setw(4) << x << '\n';
cout << setprecision(5) << p << "XYZ" << setprecision(3) << p << '\n';
cout <<setw(2) << "****" << "ABC" << setprecision(1) << x << '\n';
cout << setw(8) << setprecision(6) << p << '\n'; 

cout.unsetf(ios::showpoint); //deactivating decimal display. 

return 0;
}

OUTPUT                                                                               WORK

   ## 754
3.1416XYZ3.14
****ABC754
 3.14156