Question: Instructions: Write a C++ program that uses a function to shift an array and store the result in a separate array. The shift operation performed

Instructions: Write a C++ program that uses a function to shift an array and store the result in a separate array. The shift operation performed will be a left shift.

This C++ program needs to compile successfully on Visual Studio 2015.

The function that you write must have the following parameters:

Input arguments:

Array of Characters. This is the original array. This could also be a pointer to an array of characters.

Shifted array of Characters. This will store the shifted version of the original array. This could also be a pointer to an array of characters.

Size of the array.

Number of shifts.

The function needs to work with arrays of any size (indicated by argument 3) and any number of shifts (indicated by argument 4). Make sure that your function can properly perform shifts that are greater than the size of the array.

Test this function by writing a C++ program that prompts the user to input characters into an array of size 6 and 3. Additionally, allow the user to input how many times he wants to shift his array.

You can shift either a standard (constant size) array or a dynamically allocated array. If you choose to shift a dynamically allocated array, your program needs to de-allocate the array by using the delete[] instruction after the array is no longer needed.

Display the results as it is illustrated below:

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!