void main()
{
float x,y;
printf("input x:");
scanf("%d",&x);//%d 改成 %f
y=0;
if(x>=0)
{
if(x>0)
y=1;
}
else
y=-1;
printf("y is %4.0f.\n",y);
}
程序2
void main()
{
float x,y;
printf("input x:");
scanf("%d",&x);//%d 改成 %f
y=0;
if(x<=0)
{
if(x<0)
y=-1;
}
else
y=1;
printf("y is %4.0f.\n",y);
}