为何运行成功了,但是无法运算啊?
#include<stdio.h>int add(int a,int b)
{
int c;
c=a+b;
return(c);
}
int jian(int a, int b)
{
int c;
c=a-b;
return(c);
}
int cheng(int a,int b)
{
int c;
c=a*b;
return(c);
}
int chu(int a, int b)
{
int c;
c=a/b;
return (c);
}
int ys(int a, int b)
{
int c;
c=a%b;
return c;
}
void main()
{
int a,b,c;
char f;
printf("please input 运算符:\n");
scanf("%c",&f);
printf("please input number:\n");
scanf("%d %d ",&a,&b);
switch('f')
{
case'+': c = add(a,b);break;
case'-': c = jian(a,b);break;
case'*': c = cheng(a,b);break;
case'/': c = chu(a,b); break;
case'%': c = ys(a,b);break;
}
printf ("the resule is: %d",c);
}