Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

programming language Myt x FENG X Mob My My! X wm Lab X Drop Mior x http Micr x bbhosted.cuny.edu/webapps/blackboard/execute/content/file?cmd=view&content_id=44389716.18 course id= 1839575 1&frame 77

programming language

image text in transcribed

image text in transcribed

Myt x FENG X Mob My My! X wm Lab X Drop Mior x http Micr x bbhosted.cuny.edu/webapps/blackboard/execute/content/file?cmd=view&content_id=44389716.18 course id= 1839575 1&frame 77 LED 2 // Description Write a program that will evaluate the roots of a quadratic function. Remember the quadratic function may have 3 types of roots (1) Two real roots, (2) 1 Real root or (3) Two imaginary roots / 17 el 1/ 1. Declare the needed variables // 2. Collect the user input (variables a, b and a // 3. Find first the discrimant: b^2 - 4ac // 4. Based on the discriminant find the roots. 11 (1) When discriminant > 0, 2 real roots 11 (2) When discriminant - 0, 2 real root 17 (3) When discriminant #include using namespace std; // Header file needed for I/O // Needed for the square root // Line used for simplicity int main() // 1. Declare the variables needed for this program. 17. Use a, b, c as integers, but ri, r2 as doubles // declare dis as double also. int a, b, c; double discriminat, rl, r2; // 2. Collect the user input needed: a, b and e. cout > a; cout > b; cout > c; // 3. Once the input is done, find the discriminant // (See formula above) // ****** // 4. Use the discriminant from part (3) to determine // if the function has 2 real roots, 1 real root or // 2 imaginary roots. // See formula above. ...pdf CS101-h2 (1).pdf X ENO X Mob x Myll My Lab Drop x Micro hosted.cuny.edu/webapps/blackboard/execute/content/file?cmd=view&content_id= 443897161&course cout > b; cout > C; 1/ 3. Once the input is done, find the discriminant 1 (See formula above) 174. Use the discriminant from part (3) to determine 1/ if the function has 2 real roots, 1 real root or 1/2 imaginary roots. // See formula above. // NOTE: YOU CANNOT JUST take the SORT of the discriminant // without knowing if there are imaginary roots. // If the roots are imaginary you need to print the i factor // after the number: cout

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_2

Step: 3

blur-text-image_3

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

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

6. What questions would you suggest should be included?

Answered: 1 week ago