Question: Lab EGRE245 Fall 2018 1. Write a C program that includes a function named solvePoly(x) that computes the following polynomial at value x (a double):
Lab EGRE245 Fall 2018 1. Write a C program that includes a function named solvePoly(x) that computes the following polynomial at value x (a double): 7-6 Write a program that asks the user to enter a value for x, calls your solvePoly function to evaluate the polynomial passing it x, then dis- plays the returned double value. 2. Write a new function called solvePoly2 that is passed a double array of size 6 (that represents up to a 5th degree polynomial), a value for x, and then, as before, it evaluates the polynomial at x and returns this value as a double. For example, the polynomial shown above would be represented like this: P -6 71 -52 3 (i.e. the coefficient in the 0th cell represents the x coefficient, the coefficient in the 1st cell represents the x coefficient, etc.) Here is a second example: p 42 0 3 0 The array p here stores the polynomial 3zr2x+4 Calling a function to compute the power of x raised to some value is a great help in writing this program; such a function is defined on page 362 in the notes or, if you prefer, you can use the function provided irn the C libraries (via math.h). (see next page for help sheet)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
