#include <stdio.h> int main(void){ double x;int flag;printf("Enter x: \n"); scanf("=%lf",&x);if(x >0){ flag=1;}else if (x==0){flag=0;}else (x<0);{flag=-1;}printf("f(%.2lf)=%d\n",x,flag); return 0; } 程序的功能是輸入一個浮點數x,如果x大于0,flag等于1,如果x小于0,flag等于-1,如果x等于0,flag等于0。總是輸出-1,哪里有錯誤,實在找不到了。
- 2 回答
- 0 關注
- 823 瀏覽
添加回答
舉報
0/150
提交
取消