
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
write a c++ code please test it

Transcribed Image Text:Quadratic equations are the polynomial
equations of degree 2 in one variable of type
f(x) = ax²+bx+c. Where a, b, c, ER and
a * 0. It is the general form of a quadratic
equation where 'a' is called the leading
coefficient and 'c' is called the absolute term of
f(x).
The roots of a quadratic equation are the
values of the variable that satisfy the equation.
They are also known as the "solutions" or
"zeros" of the quadratic equation. For example,
the roots of the quadratic equation
x²7x + 10 are *₁ = 2 and ₂
- 5
because they satisfy the equation (i.e. when
each of them is substituted in the given
equation we get 0).
The first step to solve the equation is to find
the determinant which equals 6² 4ac. Based
on the determinant value, we have three
possibilities for the equation roots:
●
If determinant > 0, the equation has two
real and different roots which are:
x1 =
and
-b-√determinant
2a
-b+√determinant
x2 =
2a
If determinant = 0, the equation has one
-b
real root which is: x =
2a
• If determinant < 0, then the equation has
two complex (i.e. not real) roots which
✓determinant
-i and
2a
are: x1 =
-b
2a
X2
=
-b
2a
determinant
2a
•
∙i.
In this question, you are asked to write a
program that finds the roots of any quadratic
equation. The program requests the user to
insert the three coefficients a, b, and c,
respectively and outputs the values of the
roots as follows:
• If there are two real different roots, the
program prints the root ₁ then the root
2 with a single space between them.
• If there is a single real root, the program
prints the root only once.
• If there are two complex different roots,
the program prints the root ₁ then the
root x2 on a new line.
)

Transcribed Image Text:is
e
1/0
S
1/0
• Do not add any cout statements
except for the final outputs as
shown in the sample test cases. Do
not add "Enter the cofficients",
"root1 =" or any similar prompts.
• You can include other libraries in
your code if needed.
Program Input:
The three coefficients a, b, and c of any
quadratic equation
Program Output:
The values of the roots
Sample Testcase 0:
Input:
110
Output:
-10
Sample Testcase 0:
Input:
110
Output:
-10
Input:
gr
at 1-45
rt
Sample Testcase 1:
Output:
2-11
2+1i
Sample Testcase 2:
Input:
4-41
Output:
0.5
C
E
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 4 steps with 4 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- In C++ fill in the blanksarrow_forwardIn C++ coding please 13.4 Programming 4: Binary Conversion In this assignment you will read in a string of 0's and 1's, you will then convert this to its decimal integer value and print that value on a single line (ending with a newline). For example: INPUT:0010 OUTPUT:2arrow_forwardanswer in c++arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education