倒序输出是简单的,可以纯粹当成字符串处理,也可以循环除10
程序代码:
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string str;
int n;
cin>>str;
reverse(str.begin(), str.end());
cout<<str<<endl;
cin>>n;
while(n)
{
cout<<(n % 10);
n /= 10;
}
cout<<endl;
return 0;
}