How do I write a C++ program to compute a polynomial using loops?
I'm supposed to solve the polynomial function Pn(X) with x=2 and n=10
Pn(X)=1+x+1/2! x^2+...+1/n! x^n (why is the ... in there?)
i know I plug for x and loop for n (I think)
I'm thinking of going this route with it
1 2 3 4 5 6 7
double polynomial (longint x, longint n)
{double result;
result =(1.0+x+1.0/factorial(2))*x^2;
for (int count=0; count<= n; count++)
result +=double(1.0 /factorial (count)*x^count);
return result;
}
dont I need to declare ? int x = 2;
and what is the ..... for?
I know I'm missing some small things here I just don't know what!!!
Thank You for reading this