include <stdio.h>
int main()
{
double x;
int y;
scanf("%d",&x);
if(x>0)
y=1
else
{
if(x<0)
y=-1;
else y=0;
}
printf("%d\n",y);
return 0;
}
我不知道哪里错了。。。
逻辑上不知道哪里错了。。。。。我输入正数它输出的还是-1
追答建议你用if,else if ,else
--------------------------
if(x>0){
y=1;
}
else if(x<0){
y=-1;
}
else{
y=0;
}
逻辑上不知道哪里错了。。。
本回答被网友采纳