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()
{
vector
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
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