标题:大家来看看!!!!
只看楼主
xiangz9025
Rank: 1
等 级:新手上路
帖 子:36
专家分:0
注 册:2007-10-30
结帖率:100%
 问题点数:0 回复次数:0 
大家来看看!!!!
include "iostream.h"
#include "stdlib.h"
#define N 12

void process(float *p,int n,float (*fun)());
float arr_sum(float arr[],int n)
{
        int i;
        float sum=0;
        for(i=0;i<n;i++)
                sum+=arr[i];
        cout<<"数组和为:";
        return(sum);
}
void process(float *p,int n,float  (*fun)())   //调用功能函数
{
        float result;
        result = (*fun)(p,n);
        
        cout<<result<<endl;
        return ;}
void main()
{
  int i;
  float a[N];
  cout<<"输入要选课的系统:";
  for(i=0;i<N;i++)
          cin>>a[i];
  float arr_odd(),(*pt)();
  int n = N;
  pt = arr_odd();
  process(a,n,pt);
  process(a,N,arr_odd);
}


D:\c++\book\21function\21function.cpp(20) : error C2197: 'float (__cdecl *)(void)' : too many actual parameters
D:\c++\book\21function\21function.cpp(68) : error C2440: '=' : cannot convert from 'float' to 'float (__cdecl *)(void)'
        There is no context in which this conversion is possible
执行 cl.exe 时出错.



实在是新手,刚开始学,希望各位老师不吝赐教!谢谢!!!!!!!!!!!!!!!
搜索更多相关主题的帖子: include process return result 
2007-12-02 01:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-189825-1-1.html




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

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