Question: Hello! Im a bit stuck on this practice problem so if anyone could help with it then thank you Exercise 3 : Add to class

Hello! Im a bit stuck on this practice problem so if anyone could help with it then thank you Exercise 3: Add to class Vector20 an insert() function. Given an index (target) and a new value (x), the insert function is to insert the stated value at the stated index. You will develop this function yourself.
Design and then implement the algorithm that accomplishes the insertion. Your function will
have three important stages:
(1) Add a copy of the last (back) element of the vector with push_back.
(2) Beginning at index theSize -2 and ending at the target index, copy each element to the
next index (+1).
(3) Place the new value x at the target index.

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!