回复 8楼 canxden
不简单
float a1,a2,answer; char op; scanf("%f%c%f",&a1,&op,&a2); if(op=='+'||op=='-'||op=='*'||op=='/') {switch(op) { case '+':answer=a1+a2;break; case '-':answer=a1-a2;break; case '*':answer=a1*a2;break; case '/':answer=a1/a2;break; } printf("Answer is %f\n",answer);} else printf("输入错误");