#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
while(1)
{
int num1,num2,op;
scanf("%d%c%d",&num1,&op,&num2);
float ans;
switch(op)
{
case '+':
ans=num1+num2;
printf("%.0f",ans);
break;
case '-':
ans=num1-num2;
printf("%.0f",ans);
break;
case '*':
ans=num1*num2;
printf("%.0f",ans);
break;
case '/':
ans=num1/num2;
printf("%.2f",ans);
break;
default:
printf("請輸入+-*/");
}
}
return 0;
}
沒有留言:
張貼留言