How to Use the Reverse() Function

How to use the reverse() function

1. Reverse function reverses string

string N;
cin>>N;
reverse(N.begin(), N.end());//begin & end;

2. The reverse function reverses the character array

char s[101];
cin.getline(s,sizeof(s));      //You can also do without cin.getline
int m=strlen(s);
reverse(s,s+m);
puts(s);

3. The reverse function reverses the integer array

int a[100];
reverse(a,a+10);         //The second parameter is the next address of the last element of the array;

Read More: