is program illustrates the how the showpoint, setpre d fixed manipulators operate both individually and w ude // Header file needed to use str ude E namespace std; in program ain() ouble x = 6.0;

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.5: Case Studies
Problem 3E
icon
Related questions
Question
Step 5)
// This program illustrates the how the showpoint, setprecision,
// and fixed manipulators operate both individually and when used together.
#include <iostream>
#include <iomanip>
using namespace std;
// Header file needed to use stream manipulators
// main program
int main()
{
double x =
6.0;
cout <« x << endl;
cout <« showpoint <« x << endl;
cout <« setprecision(2) <« x « endl;
cout <« fixed <« x « endl;
return 0;
}
EXPECTED OUTPUTS:
OBSERVED:
Transcribed Image Text:Step 5) // This program illustrates the how the showpoint, setprecision, // and fixed manipulators operate both individually and when used together. #include <iostream> #include <iomanip> using namespace std; // Header file needed to use stream manipulators // main program int main() { double x = 6.0; cout <« x << endl; cout <« showpoint <« x << endl; cout <« setprecision(2) <« x « endl; cout <« fixed <« x « endl; return 0; } EXPECTED OUTPUTS: OBSERVED:
Step 4) For each of these codes, write the expected outputs on your paper, and then run
the code and compare your answers.
// This program uses setw to display three rows of numbers so they align.
#include <iostream>
#include <iomanip>
using namespace std;
// Header file needed to use setw
// main program
int main()
{
837,
num6 = 1623,
int num1
num3 =
2897, num2 = 5,
num5 = 7,
num7 = 390, num8 = 3456, num9 = 12;
%3D
num4 = 34,
// Display the first row of numbers
cout <« setw(6) « num1 << setw(6) <« num2 <« setw(6) << num3 << endl;
// Display the second row of numbers
cout <« setw(6) « num4 << setw(6) « num5 « setw(6) <« num6 << endl;
// Display the third row of numbers
cout <« setw(6) « num7 << setw(6) « num8 « setw(6) << num9 << endl;
return 0;
}
Transcribed Image Text:Step 4) For each of these codes, write the expected outputs on your paper, and then run the code and compare your answers. // This program uses setw to display three rows of numbers so they align. #include <iostream> #include <iomanip> using namespace std; // Header file needed to use setw // main program int main() { 837, num6 = 1623, int num1 num3 = 2897, num2 = 5, num5 = 7, num7 = 390, num8 = 3456, num9 = 12; %3D num4 = 34, // Display the first row of numbers cout <« setw(6) « num1 << setw(6) <« num2 <« setw(6) << num3 << endl; // Display the second row of numbers cout <« setw(6) « num4 << setw(6) « num5 « setw(6) <« num6 << endl; // Display the third row of numbers cout <« setw(6) « num7 << setw(6) « num8 « setw(6) << num9 << endl; return 0; }
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr