Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the following C++ code: Main program: declare an array of 100 integers cal

ID: 3676300 • Letter: W

Question

Write the following C++ code:

Main program:

declare an array of 100 integers

call openFile

call getData

call getExtremes

call output

Functions:

openFile: ask the user for the name of an input file and read their response try to open the specified file if the file did not open successfully: write out an error message ask for a new name and try to open that file repeat asking for file names until one opens successfully

getData: read up to 100 integer values in from the open input file, storing all of the values into the array. Send back the array with the new values and the count of how many values were stored into the array (the data size).

getExtremes: go through all of the data in the array and bring back both the largest and the smallest values in the array data.

output: write all of the array data to the screen, with 10 values per line write out the extreme values (largest and smallest) that were previously found in main.

Explanation / Answer

different function merge these functions

openFile:

getExtremes:

getdata