简单计算器
#include<stdio.h>
int main()
{
int a,b;
char d;
scanf("%d %d %c",&a,&b,&d);
switch(d)
{
case'+': printf("%d",a+b); break;
case'-': printf("%d",a-b); break;
case'*': printf("%d",a*b); break;
case'/':
if(b==0)
{
printf("Divided by zero!");break;
}
else
{
printf("%d",a/b); break;
}
default: printf("Invalid operator!");
}
return 0;
}