Dynamic Array Allocation . Bitwise Operations
Create a 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
Student Learning Outcomes:
- Dynamic memory allocation and handling
- Creating, throwing, and catching exceptions
SAMPLE ASSIGNMENT