程序参考:#include <stdio.h>int func(int a,char c,int b){ int r; switch(c) { case '+': r=a+b; break; case '-': r=a-b; break; case '*': r=a*b; break; case '/': r=a/b; break; } return r;}void main(){ int a,b; char c; scanf("%d%c%d",&a,&c,&b); printf("%d\n",func(a,c,b));}测试结果