int main(void)
{
main(void)
{ float data1,data2;*/
char op;*/
printf(“Please enter the expression:”);
scanf(“%f %c %f”,&data1,&op,&data2);
return 0;
}
}
int main(void)
{ case ‘+’: /*处理加法*/ printf(“%.2f+%.2f=%.2f\n”,data1,data2,data1+data2); break;
case ‘-’: /*处理减法*/
printf(“%.2f - %.2f=%.2f\n”,data1,data2,data1-data2); break;
case ‘*’: /*处理乘法*/
printf(“%.2f * %.2f=%.2f\n”,data1,data2,data1*data2); break;
case ‘/’: /*处理除法*/ if(data2= =0) printf(“Division by zero!\n”);
else printf(“%.2f / %.2f=%.2f\n”,data1,data2,data1/data2) break;
default: printf(“Unknown operater!\n”);
return 0;
}
}