急啊!哪位好心人帮帮忙啊!计算方法编程!
就是找人帮忙改哈程序撒,题目我上面写着在,这个是我的程序;有点问题需要改改
#include"stdio.h"
#include"conio.h"
#include"math.h"
#define N 6
double x[N]={0.5,1.0,1.5,2.0,2.5,3.0};
double y[N]={0.541688,-0.042060,0.375089,0.624706,-0.887597,0.099809};
double F[N][N];
void chashangjisuan(double x[N],double y[N],double F[N][N])
{
int j,k,p;
for (j=0;j<=N-1;j++)
F[j][0]=y[j];
for (j=0;j<=N-1;j++)
for (k=1;k<=N-1;k++)
{
F[j][k]=(F[j][k-1]-F[j-1][k-1])/(x[j]-x[j-k]);
}
printf("\n%12s%12s","Xj","F(Xj)");
for (p=1;p<=N-1;p++)
printf("%6d%2s",p,"step");
printf("\n");
for (j=0;j<=N-1;j++)
{
printf("%6f",x[j]);
for (k=0;k<=j;k++)
printf("%12f",F[j][k]);
printf("\n");
}
printf("\n");
}
main ()
{
int i,t,n;
double L;
float X;
void chashangjisuan(double x[N],double y[N],double F[N][N]);
chashangjisuan(x,y,F);
printf("\n shuru chazhi jiedian de cishu t=");
scanf("%d",&t);
for (i=1;i<=t;i++)
{
printf("\n input X%d=",i);
scanf("%f",&X);
L=F[N-1][N-1];
for(n=N-2;n>=0;n--)
L=L*(X-x[n])+F[n][n];
printf("L(%f)=%f\n",X,L);
}
getch();
return (0);
}