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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started