计算机程序设计实践答案(江苏科技大学)
1,#include class PP { int n; double x; double *p; public:
PP(int num,double x1); ~PP();
double fun(int n1,double x); void process(); void show(); };
PP::PP(int num,double x1) {
n=num; x=x1;
p=new double[n+1]; }
PP::~PP() {
if(p) delete[]p; }
double PP::fun(int n,double x) {
if(n==0) return 1; else if(n==1) return x;
else return ((2*n-1)*x*fun(n-1,x)-(n-1)*fun(n-2,x))/n; }
void PP::process() { int i;
for(i=0;i<=n;i++) p[i]=fun(i,x); }
void PP::show() {
int count=0;
cout<
for(int i=0;i