Question: Do not use built-in power function. And power must be >= 0 and integer. Do not use array or string etc. Read inputs

 Do not use built-in power function. And power must be >= 0 and integer. 

 Do not use array or string etc.

  Read inputs inside evaluate Polynomial function. 

 Display output in main function.


x 1, ... , az x,a1 x', ao 1. Write a C++

x 1, ... , az x,a1 x', ao 1. Write a C++ function that evaluates polynomials an an x" + an-1 x. It should take following inputs: Value of x. Highest power n. Coefficients in descending order an, an-1, ... , a2 , ai , ao (coefficients will ne n+1) For instance, if x=4, n=3 & coefficients are [2,3,1,2], then output should be 182 which is obtained by evaluating the polynomial 2 * 43 +3 * 42+1 * 4+2 * 4 Function Prototype: double evaluatePolynomial(); Example01:* x = 4 p= 3 Enter 4 coefficients in descending order of power ***Marks: 02 2 3 1 2 output: 182 Example02: x= -2.5 p= 7 Enter 8 coefficients in descending order of power ****Marks: 02 -2 -4.6 1 output: 1032.265625 Example03:******* x = -2.5 p= 0 Enter 1 coefficients in descending order of power 7 10 :S******************** output: 7 *******Marks: 01 Example04:* x = -2.5 p=-4 output: Error (power must be >-0)

Step by Step Solution

3.50 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

According to the guidance provided by dear student the array and inbuil... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!