reverse 函数,也是stl库里的一种很重要的函数,需要牢记。
关注作者,带你探索c++无尽奥秘
#include<iostream>
#include<algorithm>//逆转字符串
using namespace std;
int main()
{
string s;
cin >> s;
reverse(s.begin(), s.end());
cout << s;
}
reverse 函数,也是stl库里的一种很重要的函数,需要牢记。
关注作者,带你探索c++无尽奥秘
#include<iostream>
#include<algorithm>//逆转字符串
using namespace std;
int main()
{
string s;
cin >> s;
reverse(s.begin(), s.end());
cout << s;
}