HDU 1170 Balloon Comes!

#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
   {
        char c,demo;
        int a,b;
        scanf("%c%c%c%d%c%d",&demo,&c,&demo,&a,&demo,&b);
        if (c=='+') printf("%d\n",a+b);
        if (c=='-') printf("%d\n",a-b);
        if (c=='*') printf("%d\n",a*b);
        if (c=='/') 
        {
             (a%b==0)?printf("%d\n",a/b):printf("%0.2f\n",(float)a/(float)b);   
        }
    } 
    //system("pause");
    return 0;
}
 
posted @ 2013-12-22 12:58  forever97  阅读(126)  评论(0编辑  收藏  举报