Tried to ask my prof a question today about it but she didn't explain why. With line 21, when I run it as is it displays 7.000 as desired, but not spaced 5 spaces. Tried searching my problem and consulting the textbook but nothing came up. It feels kind of silly as if I'm missing a minor thing.
//This program is to practice formatting outputs with stream manipulators
#include <iostream>
#include <iomanip>
usingnamespace std;
int main(int argc, char** argv)
{
//Values are declared here
double value1 = 34.789;
double value2 = 7.0;
double value3 = 5.789e+12;
double value4 = 67;
//Display the number 34.789 in a field of nine spaces with two
//decimal places of precision
cout << setw(9) << setprecision(5) << value1 << endl;
//Display the number 7.0 in a field of five spaces with three decimal
//places of precision, with decimal point/trailing zeroes displayed
cout << setw(5) << setprecision(4) << showpoint << value2 << endl;
//Display the number 5.789e+12 in fixed point notation
cout << fixed << value3 << endl;
//Display the number 67 left justified in a field of seven spaces
cout << left << setw(7) << value4 << endl;
return 0;
}