计算器

来源:互联网 发布:linux输入法设置中文 编辑:程序博客网 时间:2024/04/29 21:40
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>int main(){    int a,c;    char b;   while(scanf("%d",&a)!=EOF)   {    scanf("%c",&b);        while(b==' ')         {             scanf("%c",&b);         }        scanf("%d",&c);       if(b=='+')       {           printf("%d",a+c);       }       else if(b=='-')       {           printf("%d",a-c);       }       else if(b=='*')       {           printf("%d",a*c);       }       else if(b=='/')       {           printf("%lf",a*1.0/c);       }   }    return 0;}
0 0