Computer science homework 9

 CS111 Assignment 9

Note: Assignments submitted by 5/8/2016 will get full score if the program works as expeced.

Write a complete C++ program that will randomly generate 20 integers between the ranges 60 – 100 and store the result in an array. The program should consists of the following functions to test out the array:

a.findMax will return the largest number of the array.

b.findMin will return the smallest number of the array.

c.findAverage will return the average of the number of the array.

d.findMinGap will return the smallest gap in between the adjacent entries of the array. (A gap between two numbers is the absolute value of their difference)

e.findGapSum will return the sum of gaps between adjacent entries of an array.

The main program should be similar to below:

int main() {
int array[20] = { };
// initialize all the value of the array;
cout << findMax(array, 20) << endl;
cout << findMin(array, 20) << endl;
cout << findAverage(array, 20) << endl;
cout << findMinGap(array, 20) << endl;
cout << findGapSum(array, 20) << endl;