Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <set>
- #include <string>
- #include <vector>
- using namespace std;
- void cycle_shift(int *arr, int n)
- {
- int arr1[n];
- for(int i = 0; i < n - 1; i++)
- {
- arr1[i] = arr[i + 1];
- }
- arr1[n - 1] = arr[0];
- for(int i = 0; i < n; i++)
- {
- cout << arr1[i] << " ";
- }
- }
- int main()
- {
- int n;
- cin >> n;
- int arr[n];
- for(int i = 0; i < n; i++)
- {
- cin >> arr[i];
- }
- cycle_shift(arr, n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement