fork(5) download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main() {
  7. vector<int> vec { 1, 2, 3, 4};
  8. reverse(vec.begin(), vec.begin()+2);
  9. for(int i = 0; i< vec.size();i++)
  10. cout<<vec[i]<<"\n";
  11. // your code goes here
  12. return 0;
  13. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
2
1
3
4