| Quad project suggestion I just had a question before I get started with my third from the last project; I wanted to know are there any threads that could help me with this project?
CSIS 121 Introduction to Computer Science
Project QUAD
Write a program that calculates the two real roots of a quadratic equation of the form:
Ax2 + Bx + C = 0
Where:
A is the coefficient of the squared term,
B is the coefficient of the linear term and
C is the coefficient of the constant term.
The quadratic formula can be used to calculate the two real roots. It follows:
_________
Root = -b ± Ö b2 – 4ac
_____________
2a
Note: the O with the periods over it is a symbol that looks like a check mark
Some sets of data for A, B and C may cause runtime errors.
The program should deal with the fact that we cannot take the square root of a negative number and we can not divide by 0.
A first algorithm for the program:
Get coefficientA, coefficientB and coefficientC from the user
If coefficientA == 0 then
Display “Coefficient of A must not be 0. This is not a quadratic equation.”
else
Calculate the discriminant
If discriminant < 0 then
Display the message “This quadratic does not have real roots,” and end
else
Calculate Root1
Calculate Root2
Display Root1
Display Root2
endif
endif
To turn in your assignment, leave a copy of your work on your login drive(M:\) in a folder called QUAD. I need the source code file QUAD.CPP and the executable file called QUAD.EXE. |