Please I have a little problem with my project. It goes
"A polynomial of degree n is represented as
Pn(x)=A0 + a1x + a2x2 + … + anxn
Where a0, a1, a2, a3 , … , an are constant coefficients. Evaluation of suc polynomials may be important if Pn(x) is to be computed many times for different values of x. Design and implement a program that asks for the user to enter a value for the degree of the polynomial n, and values for n+1 coefficient.
Your program should read these values and then in a loop it should prompt the user to enter the values for the polynomial. Your program should terminate execution if the last two values read for x are equal. Your program should be able to process polynomials of degree 6 or less."
So far i guess that n+1 should be an array, but i don't know what to do. Please I need help
Pamilerin
0
Newbie Poster
Recommended Answers
Jump to PostStructurally speaking, it should look like this:
1. Read the degree of the polinomial. ( n )
2. For i = 0 ; i <= n; i++ ( A grade N polynomial has N+1 coefficients, that's the reason for using <= instead of < )
Read the contents of an …
Jump to PostValue = a0 * x^ 0 + a1 * x ^1 + .... + aN * x^n , run through the array and compute the result.
Just as NB, don't do it directly as written, it is highly inefficient.
a0 + x*(a1 + x*(a2 + ... +x*(a[N-1] + x*aN)))))...))) is …
All 6 Replies
TotoTitus
6
Junior Poster in Training
nezachem
616
Practically a Posting Shark
TotoTitus
6
Junior Poster in Training
Pamilerin
0
Newbie Poster
TotoTitus
6
Junior Poster in Training
nezachem
616
Practically a Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.