This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Lab 4: The Discriminant Last Modified 12/18/2008 Key Concept: Math in C++, Assignment Statements, Introducing if logic Write a C++ program that computes the discriminant of a quadratic equation in the form ax 2 + bx + c = 0. Then use this to tell the user how many solutions the equation has and what kind of solutions there are. Recall that the discriminant D is given by D = b 2 4 ac. That is, it's the part of the quadratic formula that is under the square root. The value of the discriminant tells how many solutions an equation has as follows: When D > 0, the equation has 2 real solutions When D = 0, the equation has 1 real solution When D < 0, the equation has 2 imaginary solutions Part I: Discriminant Computation (the major task) First collect your inputs and compute the discriminant. Your program should display the general form required for the equation and ask the user to input the coefficients, as demonstrated below. Then compute the discriminant, store it in a variable, and display it. coefficients, as demonstrated below....
View
Full
Document
This document was uploaded on 02/10/2011.
 Fall '10

Click to edit the document details