The function of the reverse function is reverse order (or reverse), which is mostly used for strings, arrays, and containers. The header file is #include
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;//反转字符串
cin>>s;
reverse(s.begin(), s.end());
cout<<s;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v = {
1,2,3,4,5};//反转容器
reverse(v.begin(), v.end());
vector<int>::iterator it;
for(it = v.begin(); it != v.end(); it++)
{
cout<<*it<<" ";
}
}