Question: Write the Printpoly, evaluate, and terms functions. The printpoly function prints the whole polynomial. The evaluate function takes the given value for x and solves

Write the Printpoly, evaluate, and terms functions.

The printpoly function prints the whole polynomial.

The evaluate function takes the given value for "x" and solves the polynomial.

The terms function counts the number of terms in the polynomial.

Write the Printpoly, evaluate, and terms functions. The printpoly function prints the

Create a directory called lab9 on your machine using mkdir lab9 and complete the program below. You must write the three functions shown in red (printPoly, evaluate, terms). The code below can be downloaded from the course Blackboard site. lab9.c shown #include # include #include typedef struct poly double coeff int degree; struct poly *next; Poly void printPoly (Poly*) double evaluate (Poly double) int terms (Poly *) int main (void) Poly *myPoly = NULL ; printf ("Enter the coefficient and degree of a term to add to the polynomial "); double ci int d scanf ("%If %d", &c , &d); while ( ! ( fabs (c-0.0) coeffc; newNode->degreed newNode->next = myPoly; myPoly = newNode; printf ("Enter a coefficient and degree (or 0 0 to stop adding terms)"); scanf ( " % 1 f %d", &c, &d); printf (" ") printf ("The polynomial is : "); printPoly (myPoly) printf (" ") printf ("The polynomial has %d terms ", terms (myPoly) ); printf ("Polynomial evaluation - enter a value for x: "); double x; scanf ("%lf", &x) ; printf("\tThe value of the polynomial at x=%lf is %lf ", x, evaluate (myPoly, x) ); return 0 A sample execution of th is program is shown below Enter the coefficient and degree of a term to add to the polynomial:0.5 0 Enter a coefficient and degree (or 0 0 to stop adding terms)1.5 1 Enter a coefficient and degree (or 0 0 to stop adding terms) 2.5 2 Enter a coefficient and degree (or 0 0 to stop adding terms) 3.5 3 Enter a coefficient and degree (or 0 0 to stop adding terms)0 0 The polynomial is: 3.500000 x*3 2.500000 2+1.500000 x*1 + 0.500000 x*0 The polynomial has 4 terms Polynomial evaluation - enter a value for x : 5 The value of the polynomial at x=5.000000 is 508.000000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!