Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void permuta(int n,int a[],int k)
- {
- int v[100];
- int j=1;
- for(int i=k+1; i<=n; i++)
- {
- v[j]=a[i];
- j++;
- }
- for(int i=1; i<=k; i++)
- {
- v[j]=a[i];
- j++;
- }
- for(int i=1; i<=n; i++)
- {
- a[i]=v[i];
- }
- }
- int main()
- {
- int a[] = {0,60,45,30,10};
- permuta(4,a,2);
- for(int i=1;i<=4;i++)
- {
- cout << a[i] << " ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement