#include<stdio.h>
float count(float a,char b,float c);
int main(void)
{
float a,c;
char b;
printf("请输入一个算式:\n");
scanf("%f%c%f",&a,&b,&c);
printf("结果为:%f",count(a,b,c));
return 0;
}
float count(float a,float b,float c)
{
switch (b)
{
case'+':return a+c;break;
case'-':return a-c;break;
case'*':return a*c;break;
case'/':return a/c;break;
}
}
#include<stdio.h> float count(float a,char b,float c); int main(void) { float a,c; char b; printf("请输入一个算式:\n"); scanf("%f%c%f",&a,&b,&c); printf("结果为:%f",count(a,b,c)); return 0; } float count(float a,char b,float c) { switch (b) { case '+': return a+c; break; case '-':return a-c;break; case '*':return a*c;break; case '/':return a/c;break; } } 你最下面函数那里写成了 float count(float a,float b,float c) 应该是float count(float a,char b,float c) b是char类型的