Wrong Answer
/in/foo.c: In function 'main': /in/foo.c:8:10: warning: format '%f' expects argument of type 'float *', but argument 2 has type 'double *' [-Wformat=] scanf("%f",&x); ^
代码
#include <stdio.h>
int main()
{
double x;
int y;
printf("enter x.");
scanf("%f",&x);
if(x!=0)
{
if(x>0)
y=1;
else
y=-1;
}
else
y=0;
printf("x=%2.1f,y=%d\n",x,y);
return 0;
}