#include<stdio.h>
main()
{
float a,b;
char c;
printf("输入表达式如a+(* - /)b:\n");
scanf("%f%c%f",&a,&c,&b);
switch(c)
{
case‘+‘:printf("%f\n",a+b);break;
case‘-‘:printf("%f\n",a-b);break;
case‘*‘:printf("%f\n",a*b);break;
case‘/‘:printf("%f\n",a/b);break;
}
return 0;
}
时间: 2024-11-05 17:29:54