题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1170
除法的输出居然没有考虑整除情况,结果连续wa了三次才发现
#include<iostream>
using namespace std;
int main()
{
int t,a,b;
char c;
scanf("%d",&t);
while(t--)
{
cin>>c>>a>>b;
if(c=='+') printf("%d",a+b);
if(c=='-') printf("%d",a-b);
if(c=='*') printf("%lld",a*b);
if(c=='/')
{
if(a%b==0) printf("%d",a/b);
else printf("%.2lf",a*1.0/b);
}
printf("\n");
}
return 0;
}