!!
发个简单些的.
#include<stdio.h>
main()
{
float x,y;
char ch;
printf("输入格式:2+5\n");
scanf("%f%c%f",&x,&ch,&y);
switch(ch)
{
case '+':printf("%f\n",x+y);
break;
case '-':printf("%f\n",x-y);
break;
case '*':printf("%f\n",x*y);
break;
case '/':if (y!=0)
printf("%f\n",x/y);
else
printf("除数不能为零\n");
break;
default:printf("输入有误\n");
}
return 0;
}