Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions