全错? I need help

P1307 [NOIP2011 普及组] 数字反转

管理b员 @ 2017-06-28 19:21:20

#include<iostream>
using namespace std;
int main()
{
    int in,out=0;
    bool pst=true;
    cin>>in;
    if(in<0) pst=false;
    while(in!=0)
    {
        out=10*out+in/10;
        in/=10;
    }
    if(pst=false) out=-out;
    cout<<out;
    return 0;
}

by Hono @ 2017-06-28 21:02:07

不是 out=10*out+in/10; 而是 out=10*out+in%10;

@ 远相遥望


by HCha @ 2017-06-30 22:14:42

就是


by HCha @ 2017-06-30 22:15:19

啊前面的发错了我只是测试一下而已敬请谅解


|