#include"stdio.h"
void main()
{
float a,b,c;
char e;
printf("input a,e,b\n");/*输入两个数和符号,例如3+8*/
scanf("%f%c%f",&a,&e,&b);
switch(e)
{
case '+':c=a+b;break;
case '-':c=a-b;break;
case '*':c=a*b;break;
case '/':
if(b==0.0) printf("error\n");
else c=a/b;break;
}
printf("%f%c%f=%f",a,e,b,c);
}
温馨提示:答案为网友推荐,仅供参考