Question: c++ Please create one program to respond to Programming Challenges #10, 11 and 12 at the end of the chapter. (These challenges are named Reverse

c++

Please create one program to respond to Programming Challenges #10, 11 and 12 at the end of the chapter. (These challenges are named "Reverse Array", Array Expander" and "Element Shifter")

Make sure to declare and initialize the original array inside of main AND THEN call a function to reverse the array and then call another function to expand the array and then call a third function to shift the array. The functions to reverse, expand and shift have to be separate. Each function will return a pointer to the new array that was generated. Main will then call a displayArray function (3 separate times) to display each new array. Here's how I'd like it organized:

prototypes

main()

declare array

declare the pointers

reversePointer = reverseArray(array, SIZE)

expandPointer = expandArray(array, SIZE)

shiftPointer = shiftArray(array, SIZE)

displayArray(reversePointer, SIZE)

displayArray(expandPointer, SIZE*2)

displayArray(shiftPointer, SIZE)

You cannot just display the dynamically-created arrays in the functions that created them. You MUST display the arrays after the functions have returned their pointer to main.

To help us grade, let's initialize the firstArray to 3,6,9,12,15,18,21,24,27,30

10. Reverse Array Write a function that accepts an int array and the arrays size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should return a pointer to the new array. Demonstrate the function in a complete program. 11. Array Expander Write a function that accepts an int array and the arrays size as arguments. The function should create a new array that is twice the size of the argument array. The function should copy the contents of the argument array to the new array and initialize the unused elements of the second array with 0. The function should return a pointer to the new array. 12. Element Shifter Write a function that accepts an int array and the arrays size as arguments. The function should create a new array that is one element larger than the argument array. The first element of the new array should be set to 0. Element 0 of the argument array should be copied to element 1 of the new array, element 1 of the argument array should be copied to element 2 of the new array, and so forth. The function should return a pointer to the new array.

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!