haha1235  
#include<stdio.h>
int main(void)
{
    double value1,value2;
    char op;
    printf("Type in an epression:");
    scanf_s("%If%c%If",&value1,&op,&value2);
    switch(op){
    case'+':
    printf("=%.2f\n",value1+value2);
    break;
    case'-':
    printf("=%.2f\n",value1-value2);
    break;
    case'*':
    printf("=%.2f\n",value1*value2);
    break;
    case'/':
    printf("=%.2f\n",value1/value2);
    break;
    default:
    printf("Unknown operator\n");
    break;
    }
    return 0;
}

 

posted on 2013-10-07 11:29  haha1235  阅读(106)  评论(0编辑  收藏  举报