第三章5

#include<stdio.h>
int main(void)
{
    double value1,value2;
    char op;
     printf("Type in an expression:");
     scanf("%lf%c%lf",&value1,&op,&value2);
     
     if(op=='+')
         printf("=%.2f\n",value1+value2);
       else if(op=='-')
        printf("=%.2f\n",value1-value2);
    else if(op=='*')
         printf("=%.2f\n",value1*value2);
    else if(op=='/')
        printf("=%.2f\n",value1/value2);
    else
        printf("Unknow operator");
        
        return 0;
}

posted @ 2013-10-05 11:35  执于一念  阅读(107)  评论(0编辑  收藏  举报