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 integerStep 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