#include <stdio.h>
int test(int m,int n,char c);
int main(){
printf("请输入:\n");
int a,b;
char c;
scanf("%d%c%d",&a,&c,&b);
printf("%d\n",test(a,b,c));
return 0;
}
int test(int m,int n,char c){
int count=0;
switch (c) {
case '+':
count=m+n;
break;
case '-':
count=m-n;
break;
case '*':
count=m*n;
break;
case '/':
count=m/n;
break;
default:
count=-1;
break;
}
return count;
} |
|