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:
Total:
#include
#include
#include
#include
using namespace std;
int main
Prompt for the input and output file names
cout "Input file: endl;
string inputfile; cin inputfile;
cout "Output file: endl;
string outputfile; cin outputfile;
Construct the streams for reading and writing
ifstream ininputfile;
ofstream outoutputfile;
Check for errors and format the output stream
if infail out.fail return ;
out fixed setprecision;
Read the input and write the output
double total ;
double value;
while in value
out setw value endl;
total total value;
out "Total: setw total endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
