Question: Create a C++ program that has these functions makeArray(max: const int, min: const int, size: const int) : double randBetween(min: int, max: int) : int
Create a C++ program that has these functions
-
makeArray(max: const int, min: const int, size: const int) : double
-
randBetween(min: int, max: int) : int
In makeArray:
-
Fill a dynamically allocated integer array with random numbers between max and min
-
Loop thru the array and divide each value in the integer array by the next value in the integer array, but make sure your answer is a double
-
store the division answer in a dynamically allocated double array
-
If the integer array value is being divided by zero, throw an error.
-
Return the sum of the double array
In main:
-
Create a loop that runs 2000 times calling makeArray with max = 5, min = -5, size = 100000,
-
Catch but do not do anything with your error
Print sum and average of each loop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
