#include <stdio.h> //调用函数计算代数多项式1.1+2.2*x+3.3*x*x+4.4*x*x*x+5.5*x*x*x*x //当x=1.7时的值 float f(float,float*,int) ; main() { float b[5]={1.1,2.2,3.3,4.4,5.5}; printf("%f",f(1.7,b,5)); getchar(); } float f(【1】) { float y=a[0],t=1;int i; for(i=1;i<n;i++) { t=t*x; y=y+a[i]*t; } return y; }
#include <stdio.h> //调用函数计算代数多项式1.1+2.2*x+3.3*x*x+4.4*x*x*x+5.5*x*x*x*x //当x=1.7时的值 float f(float,float*,int) ; main() { float b[5]={1.1,2.2,3.3,4.4,5.5}; printf("%f",f(1.7,b,5)); getchar(); } float f(float x,float a[],int n) { float y=a[0],t=1;int i; for(i=1;i<n;i++) { t=t*x; y=y+a[i]*t; } return y; }
标签:4.4,1.7,1.1,int,多项式,float,C语言,3.3,填空 From: https://www.cnblogs.com/xkdn/p/17104377.html