-
What is the output of this program?
#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
int main ()
{
vector<int> VectorData;
for (int k = 0; k <= 8; k++)
VectorData.push_back(k);
VectorData.erase (VectorData.begin() + 6);
VectorData.erase (VectorData.begin(), VectorData.begin() + 4);
for (unsigned k = 0; k < VectorData.size(); ++k)
{
cout << ' ' << VectorData[k];
}
return 0;
}
-
- Compilation Error
- Runtime Error
- 4 5 7 8
- 4 5 7
- None of these
Correct Option: C
In this program, We are erasing the values in the vector based on the given condition.