#include
fun(float x)
{
int y;
if(x>0)
y=1;
else if(x你那個(gè)函數(shù)好像有點(diǎn)不對(duì)啊,不管輸入什么輸出都是0。。不好意思,確實(shí)有問(wèn)題,下面是修改的,你看看對(duì)不#include
fun(float x){ int y; if(x>0)y=1; else if(x==0)y=0; else y=-1; return(y);}void main(){ float x; int y; printf("input x:\n"); scanf("%f",&x); y=fun(x); printf("%d\n",y);}