Question: Write the program in C++ only Please read the question carefully and answer correctly ***THIS PROBLEM REQUIRES YOU TO CREATE MULTIPLE FUNCTIONS. READ THIS ENTIRE

Write the program in C++ only

Please read the question carefully and answer correctly

***THIS PROBLEM REQUIRES YOU TO CREATE MULTIPLE FUNCTIONS.

READ THIS ENTIRE PROBLEM BEFORE YOU BEGIN!!!

- NOTE this problem DOES NOT use TWO-DIMENSIONAL arrays!

Write a program that uses functions to do the following array manipulations. Your program will

create a one dimensional array and store random numbers in the array. You will also create a

second array that has the same numbers in the reverse order. Main should only consist of

variable declarations, function calls, and print statements. An outline of main is as follows (you

MUST include these comments!):

//declare a constant for size of array

const int maxnums = 30;

//declare two 1-dimensional arrays the size of maxnums

//and any other variables needed

//call initArray to store numbers in array

//call printArray to print with 5 numbers per row

//call findMax to determine max

//call findMin to determine min

//call findAvg to determine average

//print minimum, maximum, average

//call reverseArray to store numbers in second array in reverse

order

//call printArray to print the reversed array with 7 numbers per

row

Create the following functions that receive and process arrays. FOLLOW THE SPECS

BELOW FOR EACH FUNCTION make sure you are CLEAR on the inputs and

outputs. There are many similarities in these functions so write and test ONE FUNCTION

at a time!) . Start with just initArray and printArray, and build from there).

initArray Receives an array and the size of the array as parameters. Has no return. Stores random numbers in the range of 1 to 999 in the array.

printArray Receives an array, the size of the array, and the number of values to print on each row as parameters. Print the values in the array with the specified number of values (columns) per row. (Hint: use a counter to keep track of how many values have been printed and determine when to move to the next line. You could also use the mod operator. DO NOT use nested loops! WORK OUTTHE ALGORITHM BEFORE YOU CODE IT.)

findMax Receives an array and the size of the array as parameters. Determine the maximum value of the array and return that value.

findMin Receives an array and the size of the array as parameters. Determine the minimum value of the array and return that value.

findAvg Receives an array and the size of the array as parameter. Determine the average of the numbers and return that value.

reverseArray Receives two arrays, and the size of the array as parameters. Copy one array to another in reverse order. Note that it actually stores the values in the second array.

This function DOES NOT PRINT THE VALUES. FOLLOW THE OUTLINE

FOR MAIN.

Sample output: (Note your numbers will be different due to the random number generator.

The numbers are:

176 941 752 344 73

543 582 644 330 357

560 25 13 482 336

607 456 756 416 347

911 439 912 714 242

601 985 396 649 303

The largest number is 985

The smallest number is 13

The average is 496.4

The reversed numbers are:

303 649 396 985 601 242 714

912 439 911 347 416 756 456

607 336 482 13 25 560 357

330 644 582 543 73 344 752

941 176

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!