Question: Modify this program so that it writes the values in two columns, like this: 3 2 . 0 0 5 4 . 0 0 6

Modify this program so that it writes the values in two columns, like this:
32.0054.00
67.5029.00
35.0080.00
115.0044.50
100.0065.00
Total: 622.00
#include
#include
#include
#include
using namespace std;
int main()
{
// Prompt for the input and output file names
cout "Input file: " endl;
string input_file; cin >> input_file;
cout "Output file: " endl;
string output_file; cin >> output_file;
// Construct the streams for reading and writing
ifstream in(input_file);
ofstream out(output_file);
// Check for errors and format the output stream
if (in.fail()|| out.fail()){ return -1; }
out fixed setprecision(2);
// Read the input and write the output
double total =0;
double value;
while (in >> value)
{
out setw(15) value endl;
total = total + value;
}
out "Total: " setw(8) total endl;
return 0;
}
 Modify this program so that it writes the values in two

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!