```#include<stdio.h>
int main()
{
double a,b;
char c;
while(scanf("%lf%c%lf",&a,&c,&b)!=EOF)
{
if(b!=0)
{
switch(c)
{
case '+':printf("%.4lf+%.4lf=%.4lf",a,b,a+b);break;
case '-':printf("%.4lf-%.4lf=%.4lf",a,b,a-b);break;
case '*':printf("%.4lf*%.4lf=%.4lf",a,b,a*b);break;
case '/':printf("%.4lf/%.4lf=%.4lf",a,b,a/b);break;
}
}
if(c!='+'&&c!='-'&&c!='*'&&c!='/')
printf("Invalid operation!\n");
if(b==0.0)
printf("Wrong!Division by zero!\n");
}
}
个人做法,如有错误请指正。