题解 | #反向输出一个四位数#
反向输出一个四位数
https://www.nowcoder.com/practice/1f7c1d67446e4361bf4af67c08e0b8b0
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
string a;
while(cin>>a)
{
string b = a;
reverse(b.begin(),b.end());
cout<<b<<endl;
}
}
reverse函数的返回值是void 也就是没有,使用reverse函数要使用include <algorithm>的头文件,是对字符本身进行的修改。