#include <iostream>
using namespace std;
int reverse (int x);
int main ()
{
int x,n;
cout <<"请输入任意一个整数:"<<endl;
cin>>x;
cout<<"这个整数的反序数是"<<endl;
cout<<reverse(x)<<endl;
return 0;
}
int reverse(int x)
{
int n=0;
while (x>0)
{
n=n*10+x%10;
x=x/10;
}
return n;
}
运行结果(如下图)
33
心得体会:^_^