C-study/03/2/2.c

27 lines
350 B
C

#include<stdio.h>
int main()
{
float a,b;
char c;
scanf("%f %c %f",&a,&c,&b);
switch (c) {
case '+':
printf("=%.2f",a+b);
break;
case '-':
printf("=%.2f",a-b);
break;
case '*':
printf("=%.2f",a*b);
break;
case '/':
printf("=%.2f",a/b);
break;
default:
printf("无效运算符");
break;
}
return 0;
}