Answer to Question #210877 in C++ for Abende

Question #210877

Write a program that takes input from rawdata1.txt and writes a neat list of output to the screen

and to neat1.txt. Formatting instructions are used to create a neater layout: Numbers are written

one per line in a field width of 10. Each number is written with 3 digits after the decimal point.

Each number is written with a plus or minus sign. Write a function make_neat1 to format the

following text Uses “ 2345.45667 -0.0000456 34.9999 0.006788 -1 234


1
Expert's answer
2021-06-27T14:10:49-0400
#include <string>
#include <fstream>
#include <iostream>
#include <iomanip>




using namespace std;




int main () {
	 fstream file;
	 fstream file_write;
   file.open("rawdata1.txt",ios::in); //Opening a file to perform read operation
    file_write.open("neat1.txt",ios::out); //Opening a file to perform write operation
   if (file.is_open()){   
      string tp;
      while(getline(file, tp)){  
         cout << tp << "\n";  
         file_write<<tp<<setprecision(3)<<endl;
      }
      file.close();   
      file_write.close();
   }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS