一个求积分的题目,看我错在哪里?
#include<stdio.h>
#define N 1000
float fbds(float x)
{
return(1.0+x+x*x*x);
}
float jifen(float a,float b,float(*fun)(float))
{
int i;
float h=(b-a)/N,s=0;
for(i=0;i<N;i++)
s+=[(*fun)(a+i*h)+(*fun)(a+(i+1)*h)]*h/2;//error fun //利用梯形面积求微元
return s; //warn 'h' has never use
}
int main()
{
jifen(0.0,2.0,fbds);
return 0;
}
为什么出现这种情况,谁愿帮我改一下。
谢了