Skip to content

Instantly share code, notes, and snippets.

@wwhhjj
Created October 25, 2011 08:41
Show Gist options
  • Save wwhhjj/1311878 to your computer and use it in GitHub Desktop.
Save wwhhjj/1311878 to your computer and use it in GitHub Desktop.
#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