A array contains element 10,20,30,40,50
What i wanna rotate the complete array so as it will cout
will stream elements 50,40,30,20,10
I want to solve this problem using rotate function
i tried to write rotate(arr,arr+4,arr+1);
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int arr[]={10,20,30,40,50};
rotate(arr,arr+4,arr+1);
int i;
for(i=0; i<5; ++i)
{
cout<<arr[i]<<" ";
}
}
by running above program i getting output 50 10 20 30 40
which is wrong
the actual output is 50 40 30 20 10