秦九韶算法c语言程序设计的思路(秦九韶算法c语言程序)
关于秦九韶算法c语言程序设计的思路,秦九韶算法c语言程序这个很多人还不知道,今天小六来为大家解答以上的问题,现在让我们一起来看看吧!
1、同学你好。
2、我帮你实现了下! #include #define N 3 using namespace std; void main() { int a[N]; //N为多项式个数 int x; //x为变量值 int temp; //存储当前计算的值 for(int i=0;i<N;i++) { cout<<\"请输入第\"<<i+1<<\"个系数\"<>a[i]; //数组a[i]存放每一项的系数 } temp=a[N-1]; cout<<\"请输入x的值为\"<>x; for(int j=N-1;j>=1;j--) { temp=temp*x+a[j-1];//这个是迭代过程求多项式的值 } cout<<\"the result \"<<temp<<endl; }。
本文到此分享完毕,希望对大家有所帮助。