一个简单的错但我找了很久没看出问题麻烦各位指点

[复制链接]
查看11 | 回复2 | 2021-1-27 06:17:36 | 显示全部楼层 |阅读模式
errorC2664:'process':cannotconvertparameter3from'float(void)'to'float(__cdecl*)(float,float)'
Noneofthefunctionswiththisnameinscopematchthetargettype
请问是哪出问题
#include
#include
#include
//#include
charget();
chargetfirst();
floatshu();
voidchu();
voidprocess(float,float,float(*rk)(float,float));
floatadd();
floatsub();
floatmul();
floatdiv();
floatm,n;
floatmin,max;
intlimit(float,float,float,float);
intmain()
{
intch;
//floatm,n;
max=1000.0;
min=-100.0;
while((ch=get())!='q')
{
switch(ch)
{
case'a':chu();
process(m,n,add);
break;
case's':chu();
process(m,n,sub);
break;
case'm':chu();
process(m,n,mul);
break;
case'd':chu();
process(m,n,div);
break;
default:printf("错误");
break;
}
printf("再见");
return0;
}
}
charget()
{
intch;
printf("输入你的选择\n");
printf("a加s减\n");
printf("m乘d除\n");
printf("q退\n");
ch=getfirst();
while((ch!='a')&&(ch!='s')&&(ch!='m')&&(ch!='d')&&(ch!='q'))
{
printf("输入amsdq的一个");
ch=getfirst();
}
returnch;
}
chargetfirst()
{
intch;
ch=getchar();
while(getchar()!='\n')
continue;
returnch;
}
floatshu()
{
floatm;
//floatn;
charch;
while(scanf("%f",&m)!=1)
{
while((ch=getchar())!='\n')
putchar(ch);
printf("不是数字麻烦输入数字");
}
returnm;
}
voidchu()
{
//floatzhi;
printf("输入第一个数");
m=shu();
printf("输入第二个数");
n=shu();
while(limit(m,n,min,max))
{
printf("请输入有效数字");
m=shu();
n=shu();
}
}
voidprocess(floatm,floatn,float(*rk)(float,float))
{
floatzhi;
zhi=(*rk)(m,n);
printf("%f",zhi);
}
floatadd(floatm,floatn)
{
floatzhi;
zhi=m+n;
returnzhi;
}
floatsub(floatm,floatn)
{
floatzhi;
zhi=m-n;
returnzhi;
}
floatmul(floatm,floatn)
{
floatzhi;
zhi=m*n;
returnzhi;
}
floatdiv(floatm,floatn)
{
floatzhi;
while(n==0)
{
printf("输入其他的");
n=shu();
}
zhi=m/n;
returnzhi;
}
intlimit(floatbejin,floatend,floatlow,floathig)
{
intnot_good=0;
if(bejinhig||endhig)
{
not_good=1;
}
returnnot_good;
}
分 -->
回复

使用道具 举报

千问 | 2021-1-27 06:17:36 | 显示全部楼层
floatadd();
floatadd(floatm,floatn){...}声明和定义不匹配;
声明改为floatadd(float,float);

回复

使用道具 举报

千问 | 2021-1-27 06:17:36 | 显示全部楼层
声明改为floatadd(float,float);
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行