| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 5533 人关注过本帖
标题:too many actual parameters?
取消只看楼主 加入收藏
ppdva
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2010-11-28
收藏
 问题点数:0 回复次数:0 
too many actual parameters?
教科书(《C语言程序设计》(第二版)主编 丁亚涛,p174)上照抄的一个程序:

#include <math.h>
#include<stdio.h>
float integeral(double(*funp)(),float a,float b)
{
    float  s,h,y;
    int  n,i;
    s=((*funp)(a)+(*funp)(b))/2.0;  /*[f(a)+f(b)]/2作为求和的初值*/
    n=100;h=(b-a)/n;
    for (i=1;i<n;i++)
        s=s+(*funp)(a+i*h);
    y=s*h;
    return(y);
}
double  f(double x)
{
    return(sqrt(4.0-x*x));
}
main()
{
    float  s1,s2,s3;
    s1=integeral(sin,0.0,3.1415926/2);
    s2=integeral(cos,0.0,3.1415926/2);
    s3=integeral(f,0.0,2.0);
    printf("s1=%f,s2=%f,s3=%f\n",s1,s2,s3);
}
在VC6上编译时候提示“cpp(7) : error C2197: 'double (__cdecl *)(void)' : too many actual parameters”
“cpp(21) : error C2664: 'integeral' : cannot convert parameter 1 from 'double (double)' to 'double (__cdecl *)(void)'
        None of the functions with this name in scope match the target type”
怎么回事?怎么解决?谢谢
搜索更多相关主题的帖子: actual parameters 
2010-11-29 12:57
快速回复:too many actual parameters?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019836 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved