问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
#include<stdio.h>
int main()
{
double a=0, b=0;
int c;
char i;
printf("Input expression:");
scanf("%lf%c%lf",&a,&i,&b);
switch (i)
{
case '+':c=a+b; printf("%lf+%lf=%lf",a,b,c); break;
case '-':c=a-b; printf("%lf-%lf=%lf",a,b,c); break;
case '':c+ab; printf("%lf*%lf=%lf",a,b,c); break;
case '/':if (b==0)
{printf("Can not divid 0!\nExpression error!");
}
else c=a/b; printf("%lf/%lf=%lf",a,b,c); break;
default:printf("Expression error!"); break;
}
return 0;
}