Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

Students also viewed these Databases questions

Question

If A is an m n matrix, show that col A = {AX| X in Rn}

Answered: 1 week ago

Question

Identify three types of physicians and their roles in health care.

Answered: 1 week ago

Question

Compare the types of managed care organizations (MCOs).

Answered: 1 week ago