asd740734852 @ 2017-07-09 11:04:03
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
long long int a;
cin>>a;
if(a==0)
cout<<0;
if(a>0)
{
while(a>=1)
{cout<<a%10;
a=a/10;}}
if(a<0&&a%10!=0)
{
while(abs(a)>=1)
{
cout<<a%10;
a=abs(a/10);
}
}
if(a<0&&a%10==0)
{while(a%10==0)
{a=a/10;}
while(a%10!=0&&abs(a)>=1)
{cout<<a%10;
a=abs(a/10);
}
}
return 0;
}
by jklover @ 2017-07-09 12:50:09
请修改版面,看不懂!
by lpy123 @ 2017-07-14 11:03:44
#include<iostream>
using namespace std;
int a[10001];
bool check=false;
int main(){
int n,i=0;
cin>>n;
if (n==0){
cout<<0;
return 0;
}
if (n<0){
cout<<"-";
n=-n;
}
int x=n;
while (n!=0){
i++;
a[i]=n%10;
n=n/10;
}
for (int j=1;j<=i;j++){
if (check==false && a[j]==0) continue;
if (a[j]!=0) check=true;
cout<<a[j];
}
}