Great Deal! Get Instant \$10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

To start, you're going to make an array that's full of random integers. This array should have a number of elements that is controlled by a global constant int, like this: const int SIZE = 20; You...

`To start, you're going to make an array that's full of random integers. This array should have a number of elements that is controlled by a global constant int, like this:  const int SIZE = 20;  You should do a few different things with your array. First, you need to fill it with the random numbers. The rand() function will give you a random integer from 0 to RAND_MAX (a big number). To access the rand() function, you may need to include the library . Also, the numbers that you put into the array should only be between 0 and 100. The function prototype to fill your array should look like this:  void fill(int arr[SIZE]);  You should not need to pass the SIZE constant to your function as an argument since it's globally declared. Next, you should print out the contents of the array. The function prototype to print your array should look like this:  void print(int arr[SIZE]);  and here is a sample output of an array printing XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX  Next, you should print a chart of ranges of numbers. The ranges you should use are 0-9, 10-19, 20-29, XXXXXXXXXXFor each range, you will print a star for each number that is in the range. The function prototype will look like this:  void printRanges(int arr[SIZE]);  and here is the sample output corresponding to the array above  00: ** 10: 20: *** 30: ** 40: *** 50: * 60: ***** 70: * 80: * 90: **  Lastly, you're going to use a filter to smooth the above data. This is a fancy way of saying something quite simple. You want the numbers to be closer to the values of their neighbors. To accomplish this, you use a 'moving average,' where you average each number with it's neighbors to get a new value. In the example above, the new zeroeth element would be 54 since that's the average of 41 and 67. The next value would be 47 since XXXXXXXXXX)/3 = 47. Here is the prototype for the moving average:  void movingAverage(int arr[SIZE]);  and here is the sample output corresponding to the array above XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX31  In main, you should use these functions in the following way. Declare and fill an array then print its values and ranges. Next, apply the movingAverage function to the array ten times, then reprint the ranges. Did the graph change in the way you expected? Why or why not?`
Answered Same Day Jul 27, 2021

Solution

Arun Shankar answered on Jul 31 2021
#include #include #include #include using namespace std;
const int SIZE = 20;
* A function to print out the contents of
the a
ay on the console. *
void print(int a
[SIZE])
{
for(int i=0;i cout
a
[i]
" ";
cout
endl;
}
* A function to fill the a
ay a

with SIZE random numbers in the range 0-100 *
void fill(int a
[])
{
srand(time(0));
for(int i=0;i a
[i] = rand()%100;
}
* A function to print a chart of the range of
numbers...
SOLUTION.PDF