Question
Write a C++ program that uses a function to shift the rows of a 2D Vector. Define the function that will shift the 2D Vector
Write a C++ program that uses a function to shift the rows of a 2D Vector. Define the function that will shift the 2D Vector as Shift_2D_Vector. Shift_2D_Vector must only have the following 2 parameters: 1. A 2 dimensional vector of integers. Call this parameter: table 2. A unsigned integer that will store the number of shifts. Call this parameter: num_of_shifts. The function needs to work with 2D vectors of any size and any number of shifts. Make sure that your function can properly perform shifts that are greater than the size of the vector. Test this function by writing a C++ program that prompts the user to input the number of rows and columns that the vector will have. Additionally, allow the user to input how many times he wants to shift the vector.
It is supposed to run exactly in the picture. That's a sample run.
How many rows wilI the vector have ? 3 How many columns will row have ? nput a value into row b. I How many columns wiII row l have ? 2 Input a value into row 1: 1 nput a value into row How many columns W11 row Z have 3 Input a value into row 2: 1 nput a value into roW Input a value into row 2: 3 The following is the vector that you inputted 1 2 3 How many times do you want to shift this vector? 4 The folioW 1 ng 1S your shifted vector 1 2 3 Press any key tO cont i nueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started