ExamVeda
Login
Home
C plus plus miscellaneous
?

What will be the output of the following C++ code?
#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;
}

Answer & Solution
Correct Answer: Option B
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.