Ethan O.

asked • 10/19/19

How do I program this problem?

Write a program to read 10 integers from an input file, “num.txt”, and output the average, minimum, and maximum of those numbers to an output file “out.txt”. Also make sure to test for the condition ifthe count of numbers is less than 10, then your average should reflect only for that many numbers


Include “#include <climits> in your code and set min = INT_MAX”


Note that you need to run your program twice.


1.First have 12 numbers in num.txt but read only 10 numbers from the file.


2.Second time have 8 numbers in num1.txt and check average for 8 numbers instead of 10 numbers. You can name the text file with 8 numbers as num1.txt and its corresponding output file as out1.tx

1 Expert Answer

By:

Patrick B. answered • 10/20/19

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.