Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. #include <set>
  4. #include <string>
  5. #include <vector>
  6.  
  7. using namespace std;
  8.  
  9. void cycle_shift(int *arr, int n)
  10. {
  11. int arr1[n];
  12. for(int i = 0; i < n - 1; i++)
  13. {
  14. arr1[i] = arr[i + 1];
  15. }
  16. arr1[n - 1] = arr[0];
  17. for(int i = 0; i < n; i++)
  18. {
  19. cout << arr1[i] << " ";
  20. }
  21. }
  22. int main()
  23. {
  24. int n;
  25. cin >> n;
  26. int arr[n];
  27. for(int i = 0; i < n; i++)
  28. {
  29. cin >> arr[i];
  30. }
  31. cycle_shift(arr, n);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement