Answered step by step
Verified Expert Solution
Question
1 Approved Answer
First, ask for input and execute your quadratic solver exactly as you did before. Compute the roots x1 and x2, and printf them out as
First, ask for input and execute your quadratic solver exactly as you did before. Compute the roots x1 and x2, and printf them out as part of an appropriate message, exactly as you did for Assignment 1. The one difference: Change all your float variables to double variables, to have better arithmetic precision. (This means you should also change %f to %lf in all your printf() statements!) And Now, Something Different: Now, for the new task: evaluate y = ax? +bx+c and print the results, for: 3 (0.0, 1.0, 2.0, 3.0, ..., 10.0) ( 3 (1.0, 0.1, 0.01,... , 0.00000001) 2 (1.0, 10.0, 100.0, 1 000 000 000.0) 3 (-10.0,-9.0,-8.0, ..., 8.0,9.0, 10.0) Three caveats: You must use loops to evaluate and print these four sets of values. You must write a single function that returns y = ar? -_ bx + cfor a given a, b, c, and X; and use the loops to call it repeatedly. Format the printouts nicely, and make sure to distinguish between the four sets of values so the output is readable! You must still go by the following: Do no arithmetic in main(). Create functions that do all your math. Do not use any global variables. You must specifically use a function to compute the discriminant - the part of the quadratic under the square root. Comment every function, every "paragraph" of code as we discussed in class, and any line of code that does more than two things. Indent your code properly. Your editor will do this for you! Let it. Your code must compile without errors (some warnings are okay at this stage - if you're concerned that a warning might not be okay, ask me) and run with any reasonable values of a, b and C - I'll be testing them on my end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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