Question: Create a program that creates an array of 500 random numbers between -10 and 10. Write several functions: Function 1 - prints the array with

Create a program that creates an array of 500 random numbers between -10 and 10.
Write several functions:
Function 1 - prints the array with a certain number of elements per line. Prototype: void printArray(int array[], int numElements, int numPerLine, ostream &os)
Function 2 prints only the array elements that are evenly divisible by an input number. Prototype: void printDivBy(int array[], int numElements, int numPerLine, int divBy, ostream &os)
Function 3 takes the input array and returns the maximum, the next-to-maximum, the minimum, and the next-to-minimum values
Function 4 returns the sum of the values in the array
Also calculate the average of the array. Your program should call each function; use the number 8 for numPerLine for the printArray function, and use 5 for numPerLine and the number 3 for the divBy value when calling the printDivBy function. Print the max, next-to-max, min, and next-to-min, the sum, and the average of the numbers from main, not from the function. Print the
Your program MUST use arrays. Your program should NOT call a sort function.
Using c++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!