Question: C++ coding HW: Create an input file, called file1, and an output file, called file2, in the program. Read the data, 3 values at a

C++ coding HW: Create an input file, called file1, and an output file, called file2, in the program. Read the data, 3 values at a time, from the input text file until you read the sentinel data line. Arrange the three values that have been read in order from lowest to highest, and then write the set of three numbers to the output file. Use a series of if statements to find the smallest, the middle value, and the largest. When all lines of data have been processed, close both files. Then reopen the output file (file2) as input. Read the data back in and print it to the screen. Use a while (!file2.eof()) to control this last part. You will need a preliminary read before the while (!file2.eof()) and another read before the end of the while loop.

Run:

Create a data file of the following integers in Notepad to run the program:

10 20 30

17 21 18

30 20 49

40 25 35

55 45 35

25 55 5

-1 -1 -1

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!