Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

//Purpose: This program displays the number of real roots for a quadratic equati

ID: 3655747 • Letter: #

Question

//Purpose: This program displays the number of real roots for a quadratic equation. // The program continues to read in floating-point values for A, B, and C // until a non-negative discriminant (B2 - 4AC) is found or the end of file is reached. //include files... #include #include using namespace std; void printMessage(float); float computeDiscriminant(float, float, float); int main() { float A, B, C; float discriminant=0; // complete the following code so that the program continues to read in // floating-point values for A, B, and C until a non-negative // discriminant (B2 - 4AC) is found or the end of file is reached. do // use a do-while loop(started above) to read in floating-point values for A, B and C // until a non-negative discriminant is found or reach the end of file. cout << "Enter three coefficients for the quadratic equations:"; cin >> A >> B >> C; // compute the discriminant using the computeDiscriminant function printMessage(discriminant); return 0; } void printMessage(float disc) { if(disc == 0) cout << "There is one root. "; else if (disc > 0) cout << "There are two roots. "; else cout << "There is no root. "; } float computeDiscriminant(float a, float b, float c) { return b*b-4*a*c; }

Explanation / Answer

#include#includeusing namespace std; void printMessage(float); float computeDiscriminant(float, float, float); int main() { float A, B, C; float discriminant=0.0; do { cout > A >> B >> C; discriminant=computeDiscriminant(A,B,C); }while(discriminant