C++函数求助 poly (double __x, int __degree, double *__coeffs);

来源:百度知道 编辑:UC知道 时间:2024/05/20 03:26:33
poly (double __x, int __degree, double *__coeffs);
这个函数怎么用,网上查到是什么多项式求值,但是试验不行,似乎不是包含在math.h中的

函数名: poly
功 能: 根据参数产生一个多项式
用 法: double poly(double x, int n, double c[]);
程序例:

#include <stdio.h>
#include <math.h>

/* polynomial: x**3 - 2x**2 + 5x - 1 */

int main(void)
{
double array[] = { -1.0, 5.0, -2.0, 1.0 };
double result;

result = poly(2.0, 3, array);
printf("The polynomial: x**3 - 2.0x**2 + 5x - 1 at 2.0 is %lf\n",
result);
return 0;
}