#include<iostream> |
using namespace std; |
int main(){ |
int x,n; |
cout<< "Please enter the value of the \"x\":\n" ; |
cin>>x; |
cout<< "Please enter the value of the \"n\":\n" ; |
cin>>n; |
|
double P( int x, int n); |
if (n==0){ |
cout<< "P(x)=" <<1; |
} |
else if (n==1){ |
cout<< "P(x)=" <<x; |
} |
else { |
cout<< "P(x)=" <<P(x,n); |
} |
return 0; |
} |
double P( int x, int n){ |
double result = 0.0; |
for (n;n>1;n--){ |
result = ((2*n-1)*x-P(x,n-1)-(n-1)*P(x,n-2))/n; |
} |
return result; |
} |
by: 发表于:2017-09-01 09:54:50 顶(0) | 踩(0) 回复
??
回复评论