Question: Write the output produced by the following function when passed each of the following vectors. Assume that a vector would print in the format {

Write the output produced by the following function when passed each of the following vectors. Assume that a vector would print in the format {10,20,30}.
void collectionMystery1(vector& list){
for (int i =0; i < list.size(); i++){
int n = list[i];
list.erase(list.begin()+ i);
if (n %2==0){
list.push_back(i);
}
}
cout << list << endl;
}

Step by Step Solution

3.50 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Source Code of the Program include include using name... View full answer

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 Programming Questions!