Question: CODE IN C++ Write a program that has the following: 1. Create a function int* GenerateRandomArray(int N) that takes an integer N and returns a

CODE IN C++

Write a program that has the following:

1. Create a function int* GenerateRandomArray(int N) that takes an integer N and returns a pointer to an array of size N initialized with random values between 1 and N. For example, if N equals to 10, calling the function from the main would result in returning a pointer to the array with random numbers between 1 and 10.

2. Create a function int* ReverseArray(int* A, int N) or int* ReverseArray(int A[], int N) returns a pointer of the reversed array of A. For example, if the array contains elements 1,2,3,4,and 5, the reserved array will contain 5,4,3,2,and 1.

3. Create a function void DisplayArray(int* A, int N) or void DisplayArray(int A[], int N) that displays the elements of the given array.

4. From your main function do the following: Creates dynamic 1D array. You can create one or more array.

Call GenerateRandomArray() function

Call DisplayArray() function

Call ReverseArray() function

Call DisplayArray() function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!