一、reverse
string s;
reverse(s.begin(),s.end());
头文件:#include<algorithm>
二、代码
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
string s = "Hello";
string s1 = s;
reverse(s.begin(), s.end());
//Hello
cout << s;
//olleH
cout << s1;
system("pause");
return 0;
}