adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    #include <vector>
    #include<iterator>
    using namespace std;
    int main ()
    {
        vector<int> myvector;
        for (int i = 1; i <= 10; i++)
        myvector.push_back(i);
        myvector.erase (myvector.begin() + 6);
        myvector.erase (myvector.begin(), myvector.begin() + 4);
        for (unsigned i = 0; i < myvector.size(); ++i)
        cout << ' ' << myvector[i];
        return 0;
    }

a.

5 6 7 8 9

b.

5 6 8 9 10

c.

6 7 8 9 10

d.

None of the mentioned

Answer: (b).5 6 8 9 10

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?