问题标题: 1005 倒序输出

0
0
已解决
刘睿轩
刘睿轩
中级光能
中级光能

里面怎么写???

#include<bits/stdc++.h>
using namespace std;
int main(){
   
    return 0;
}


0
已采纳
张睿杰
张睿杰
初级天翼
初级天翼
定义srs,i=0,sw,scs;
输入srs
    while (srs>0)
    {
        sw=srs%10;
        srs=srs/10;
        i++;
        if (i>1)
        scs=scs*10+sw;  
        else  
        scs=sw;
    }
输出srs

 

0
0
0
朱宗晔
朱宗晔
初级光能
初级光能

核心部分

while(n)
    {
        s=s*10+n%10;
        n/=10;
    }

 

0
颜咏春
颜咏春
中级光能
中级光能

while (srs>0)

 

{

 

sw=srs%10;

 

srs=srs/10;

 

i++;

 

if (i>1)

 

scs=scs*10+sw;

 

else

 

scs=sw;

 

}

0
杨陈卓
杨陈卓
新手天翼
新手天翼

定义n,s=0(int)

输入n

if(n<0)printf("-");
    n=abs(n);
    do
    {
        s=s*10+n%10;
        n/=10;
    }while(n!=0);

这是核心

最后输出s

0
舒航
舒航
新手守护
新手守护
n=abs(n);
    while(n>0)
    {
        ans=ans*10+n%10;
        n/=10;
    }

这是核心代码,望采纳!!!

记得头文件

#include<cstdlib>哦~
我要回答