Li_Junlin @ 2022-08-22 17:21:04
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x,y;
cin>>x;
if(x>0)
{
while(x>0)
{
y=x%10;
cout<<y;
x/=10;
}
}
**else if(x<0)
{
cout<<"-";
while(-x<0)
{
y=-x%10;
cout<<y;
x/=10;
}
}**
else
cout<<'0';
return 0;
}
by QwQ__ @ 2022-08-22 17:23:12
#include <bits/stdc++.h>
using namespace std;
int n,s;
int main(){
for(cin>>n;n!=0;n/=10)s=s*10+n%10;
cout<<s;return 0;
}
看一下我的吧
by 大眼仔Happy @ 2022-08-22 17:24:57
@xdm_srl 负数就先输出 -
,然后再变成正数反转
by Li_Junlin @ 2022-08-22 17:27:35
@大眼仔Happy 我这里有条件是如果是负数会输出符号你难道没有看见星号后面的???
by Li_Junlin @ 2022-08-22 17:28:14
@QwQ__ nb
by 大眼仔Happy @ 2022-08-22 17:28:29
@xdm_srl at错了,应该at我上楼那个,然后他那个就是正解了