Write a program with 3 sub-functions
to complete the following jobs:
-
read three integers from a data file,
data.txt
The following is data.txt
3
9 7
7
9 3
4
1 10
10
1 4
11
13
20
20
13
11
6
6 9
6
6 3
5
8 8
9
8 8
4
4 4
-
finding average of these
three
integers
(computeAvg function)
-
finding median of these
three
integers
(findMedian function)
-
In the main() function,
use a for
loop to repeat all jobs 11 times or use while loop until no more
data.
- In the loop, you need to get a set of data, call computeAvg and findMedian functions,
and write results on screen and a file called results.txt.
Your output will be

The result file is followed:
