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
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main () {
ifstream fr("rawdata1.txt");
ofstream fn("neat1.txt");
string text;
while (getline (fr, text)) {
fn << text;
}
fr.close();
fn.close();
}
Comments
Leave a comment