Question: Code #include #include using namespace std; int main() { vector array;//declaring the vector named arrya of type char int i; //adding the value in the

Code

#include

#include

using namespace std;

int main()

{

vectorarray;//declaring the vector named arrya of type char

int i;

//adding the value in the vecotr array

array.push_back('A');

array.push_back('B');

array.push_back('C');

array.push_back('D');

array.push_back('F');

//printing the vector value before shift

cout<<"Before shifting the char vector is: "<

for(i=0;i

cout<

cout<

//shift the array vector so last elemtn become firast

char temp = array.at(array.size()-1);

for (i = array.size()-1; i>=1 ; i--)

{

array.at(i) = array.at(i -1);

}

array.at(0) = temp;

//printing the vector value after shift

cout<<" After shifting the char vector is: "<

for(i=0;i

cout<

cout<

}

I want to make the above code a 2D vector array and make array[0][A, B, C, D, F] and shift it for array[1][F, A, B, C, D] and shift again for array[2][D, F, A, B, C]

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!