例3-9

#include<stdio.h> int main(void) {    double valuel,value2;    char op;

   printf("Type in an expression:");    scanf("%lf%c%lf",&value1,&op,&value2);    switch(op){        case'+':            printf("=%.2f\n",valuel+value2);            break;        case'-':             printf("=%.2f\n",valuel-value2);            break;        case'/':             printf("=%.2f\n",valuelalue2);             break;        default:              printf("Unknown operator\n");              break;    }    return 0; }

posted @ 2013-10-06 15:44  dihuanting  阅读(115)  评论(0编辑  收藏  举报