-
What is the output of this program?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
vector<int> VectorData(5);
fill (VectorData.begin(), VectorData.begin() + 4, 5);
fill (VectorData.begin() + 1, VectorData.end() - 2, 4);
for (vector<int> :: iterator Iter = VectorData.begin(); Iter != VectorData.end(); ++Iter)
cout << ' ' << *Iter;
return 0;
}
-
- 5
- 5 4
- 5 4 4 5 0
- 5 4 4 5
- 5 4 4
Correct Option: C
In this program, We filled out the vector values by using criteria in the for loop.