Created
October 25, 2011 11:16
-
-
Save wwhhjj/1312344 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
char op; | |
double data1,data2,r; | |
printf("请输入式子\n"); | |
scanf("%lf%c%lf",&data1,&op,&data2); | |
switch(op) | |
{ | |
case '+':r=data1+data2;break; | |
case '-':r=data1-data2;break; | |
case '*':r=data1*data2;break; | |
case '/':r=data1/data2;break; | |
} | |
printf("%lf%c%lf=%lf\n",data1,op,data2,r); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment