OJ-Problems-Source/HDOJ/1170_autoAC.cpp

22 lines
447 B
C++
Raw Normal View History

2016-08-13 10:51:15 +08:00
#include<stdio.h>
int main()
{
int n,a,b;
char c;
scanf("%d",&n);
while(n--)
{
getchar();
scanf("%c%d%d",&c,&a,&b);
if(c=='+')
printf("%d\n",a+b);
else if(c=='-')
printf("%d\n",a-b);
else if(c=='*')
printf("%d\n",a*b);
else
a%b?printf("%.2lf\n",a*1.0/b):printf("%d\n",a/b);
}
return 0;
}