Array File

Write a C++ program that reads data from a file into an integer array that will hold a maximum of 100 components. Write the following void or value-returning functions:
a. initialize all elements of the array to zero
b. read the data from a file and store it in the array
c. find the index of the component that holds the smallest value
d. find the average value stored in the array
e. print all of the elements in the array
f. print the index of the smallest value, the smallest value, the average and all of the components that are greater than the average (Make sure that all of the values printed are properly labeled.)

Don’t forget to put the statement in your program.

Save a copy of the program and the output from data1.txt and data2.txt

×
New Download