Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Discriminant = b^2-4ac Construct a C++ program that reads the values of a, b and c of the discriminant from a user and performs the

Discriminant = b^2-4ac

Construct a C++ program that reads the values of a, b and c of the discriminant from a user and performs the following:

a. If the value of the discriminant is positive, program should print out that the equation has two real roots and prints the values of the two roots.

b. If the discriminant is equal to 0, the roots are real and equal.

c. if the value of the discriminant is negative, then the equation has two complex roots.

In order to do this, create three functions: one that reads in the values, one that determines the discriminant, and one that outputs the roots. The functions should be named as follows:

void readinput( int&, int &, int&); - this function will read the input values from the user

double disc(int, int, int); - this function will determine the discriminant

void r(int, int, int); - this function will output the roots.

A sample Output is below:

Enter values for a, b and c:- 2 10 3 Discriminant = 76

Equation has two real roots Roots are as follows:- x1 = -0.320551 x1 = -0.320551

Any character to end:-

Please write explanatory comments on top of or next to each line of code.

Thank you in advance.

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

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions

Question

Organize and support your main points

Answered: 1 week ago

Question

Move smoothly from point to point

Answered: 1 week ago

Question

Outlining Your Speech?

Answered: 1 week ago