Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me get the outcome in the sample output for this question. I know I have to use while statements in all three functions

Please help me get the outcome in the sample output for this question. I know I have to use while statements in all three functions void, double, and int. Im just a little confused, thanks in advance. image text in transcribed
image text in transcribed
Create a directory called lab9 on your machine using mkdir lab9 and complete the program lab9.c showr below. You must write the three functions shown in red (printPoly, evaluate, terms). The code below can be downloaded from the course Blackboard site. #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 c int d scanf ("%lf %d", &c, &d); while ( ! ( fabs (c-0.0) coeff = c; newNode-degree = d; newNode->nextmyPoly: myPoly = newNode; printf("Enter a coefficient and degree or 0 0 to stop adding terms" scan f ( " % 1 f %d", &c , &d); printf(" ln") printf("The polynomial is : ") printPoly (my Poly) printf("nn) printf ("The polynomial has %d terms ", terms (myPoly) ); printf("Polynomial evaluation enter a value for x:") double x scanf ("%lf", 6x); printf("tThe value of the polynomial at x-lf is ifin", x, evaluate (myPoly, x) return 0 A sample execution of this 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 terms1.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.500000 x0 The polynomial is3.500000 x3 2.500000 x*2 1.500000 x1 The polynomial has 4 terms Polynomial evaluation enter a value for x5 The value of the polynomial at x=5.000000 is 508.000000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

ISBN: 133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

Find the specific volume of ammonia at 140 kPa and 0C.

Answered: 1 week ago