Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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++ 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
Step: 1
According to the guidance provided by dear student the array and inbuil...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started