int reverse(int a){
if(a/10==0){
return a;
}
int temp=1;
int b=a;
while (b/10>0){
temp*=10;
b=b/10;
}
return a%10*temp+reverse(a/10);
}
语言c++
不在递归函数中进行输出,不使用string方法
int reverse(int a){
if(a/10==0){
return a;
}
int temp=1;
int b=a;
while (b/10>0){
temp*=10;
b=b/10;
}
return a%10*temp+reverse(a/10);
}
语言c++
不在递归函数中进行输出,不使用string方法
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。