Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(C++) Assignment Plan and code a program utilizing one file for input and one file for output to solve the following problem: A file contains

(C++)

Assignment Plan and code a program utilizing one file for input and one file for output to solve the following problem: A file contains 7 numbers per line and contains several records. Write a program to input each of the numbers,find the highest number, the lowest number, their total and average. Output the numbers, the highest, lowest,total and average for each set of 7 numbers to another file.

Input 7 numbers from each record in the input file. Use the data file designated by your instructor.

Output The 7 numbers, the highest, the lowest, their total, and average for each set of 7 numbers.

Note Label all output clearly. Be sure your output file contains user prompts and what was entered by the user inaddition to the results of your program processing. Be sure your output file contains data that was input inaddition to the results of your program processing. Create the data file below using your text editor or Notepad.

Data File 346 130 982 90 656 117 595

415 948 126 4 558 571 87

42 360 412 721 463 47 119

441 190 985 214 509 2 571

77 81 681 651 995 93 74

310 9 995 561 92 14 288

466 664 892 8 766 34 639

151 64 98 813 67 834 369

Begining of program:

#include

#include

#include

#include

using namespace std; int main(){ ifstream infile; ofstream outfile; string name;

infile.open ("c:\\temp\\myfile.dat"); if (!infile) //there was an error on open, file not found

{

cout << "Cannot open file, terminating program"<< endl;

exit (1);

}

outfile.open ("c:\\temp\ ewfile.dat); infile >> name; //this is called a priming read, only used once while (infile) //or while (!infile.eof())

{

outfile <> name;

} infile.close();

outfile.close ();

return 0;}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

d. How were you expected to contribute to family life?

Answered: 1 week ago