代码都打好了,就是不能运行,有没有大佬看看是怎么回事。
#include<stdio.h>
double pow(double x,int n);
double f(int n, double a[], double x );
double f(int n, double a[], double x )
{
int i;
double p = a[0];
for ( i=1; i<=n; i++ )
p += (a[i]*pow(x,i));
return p;
}
double pow(double x,int n)
{
double b = 1;
for(int j = 1;j <= n;j++)
{
b*=x;
}
return b;
}
int main()
{
int n;
scanf("%d",&n);
double a[n+1];
for(int i = 0;i <= n;i++)
scanf("%d",&a[i]);
double x;
scanf("%lf",&x);
printf(".1lf\n",f(n,a,x));
return 0;
}