lab04 - Lab 4: The Discriminant Last Modified 12/18/2008...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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.

Page1 / 2

lab04 - Lab 4: The Discriminant Last Modified 12/18/2008...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online