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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started