fork download
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int x[] = {1,2,3,4,5};
  8. rotate(x, x+2, x+5);
  9. for (int i = 0 ; i != 5 ; i++)
  10. cout << x[i] << " ";
  11. cout << endl;
  12. return 0;
  13. }
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
3 4 5 1 2