-
What is the output of this program?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main ()
{
vector<int> num;
for (int k = 1; k < 6; ++k)
num.push_back(k);
rotate(num.begin(), num.begin() + 5, num.end( ));
for (vector<int> :: iterator Iter = num.begin();
Iter != num.end(); ++Iter)
cout << ' ' << *Iter;
return 0;
}
-
- 1
- 1 2
- 1 2 3
- 1 2 3 4
- 1 2 3 4 5
Correct Option: E
In this program, We are rotating the vector values by 5, So it is printing this option.