-
What is the output of this program?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
vector<int> VectorData;
for (int k = 0; k < 5; ++k)
VectorData.push_back(k);
reverse(VectorData.begin(), VectorData.end());
for (vector<int> :: iterator Iter = VectorData.begin(); Iter != VectorData.end(); ++Iter)
cout << ' ' << *Iter;
return 0;
}
-
- 4 3 2 1 0
- 4 3 2 1
- 4 3 2
- 4 3
- 4
Correct Option: A
In this program, We reversed the vector values by using the reverse function.