我是C语言编程小白,能不能给我解释一下图片中的代码是什么意思😊
(并附上全部源代码)
#include<stdio.h>
int main()
{
int x,f;
scanf("%d",&x);
int a=x>=0,b=x==0;
int c=a+b;
/*x<0,c=0;
x=0,c=2;
x>0,c=1.*/
switch(c)
{
case 0:
f=-1;
break;
case 2:
f=0;
break;
case 1:
f=2*x;
}
printf("f(x)=%d\n",f);
return 0;
}