Question: #include #include using namespace std; template void print(const vector & v) { for (auto myIt = v.begin(); myIt != v.end(); ++myIt) { cout //Do not

 #include #include using namespace std; template void print(const vector& v) {

#include #include

using namespace std;

template void print(const vector& v) { for (auto myIt = v.begin(); myIt != v.end(); ++myIt) { cout

//Do not modify anything on or above the line below this //YOUR_CODE_BELOW

//YOUR_CODE

//YOUR_CODE_ABOVE //Do not modify anything on or below the line above this

int main() { vector letters = {'A', 'B', 'C', 'A', 'B', 'B', 'A'};

auto lettersCopy = letters; removeAll(lettersCopy, 'C'); print(lettersCopy);

lettersCopy = letters; removeAll(lettersCopy, 'B'); print(lettersCopy);

lettersCopy = letters; removeAll(lettersCopy, 'A'); print(lettersCopy); }

Value Stripper Write a function void removeAll(vector& V, char c) that removes all copies of character c from vector v. Hints: To erase something you have to use an iterator and vector.erase(iterator) - there is no vector.erase(int location) An iterator automatically moves to the next element after you use it to erase something... make sure you don't advance twice after deleting something. I recommend a while loop instead of a for loop to make it easier to control advancing

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!