Question: Given an integer vector myVector with three elements and an input integer addSize, resize myVector to add addSize elements to the vector. After resizing myVector,

Given an integer vector myVector with three elements and an input integer addSize, resize myVector to add addSize elements to the vector.
After resizing myVector, the new elements are initialized with the default value 1.
Ex: If the input is 2, then the output is:
Start 7 6 5 End
Start 7 6 5 1 1 End
Note: Assume that addSize is a non-negative integer.
-------------------------------------
#include
int main() { vector
myVector.at(0) = 7; myVector.at(1) = 6; myVector.at(2) = 5;
cin >> addSize;
cout
// ENTER CODE HERE IN C++ (THANK YOU)
for (i = 3; i
cout
return 0; }
Given an integer vector myVector with three elements and an input integer addSize, resize myVector to add addSize elements to the vector. After resizing myVector, the new elements are initialized with the default value 1. Ex: If the input is 2, then the output is: Start 765 End Start 76511End Note: Assume that addSize is a non-negative integer
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
