Email
 Submitted on: 1/7/2015 11:38:00 AM By: Mauricio Rossi (from psc cd) Level: Intermediate User Rating: By 6 Users Compatibility: C++ (general), Microsoft Visual C++, Borland C++ Views: 1280

This program solves quadratic equations for you. All you have to do is enter the value of a, b, and c. I wanted to check my homework for my math class, so i made this program mainly overnight.

code:
Can't Copy and Paste this?
 ``` //************************************** // Name: A quadratic equation solver // Description:This program solves quadratic equations for you. All you have to do is enter the value of a, b, and c. I wanted to check my homework for my math class, so i made this program mainly overnight. // By: Mauricio Rossi (from psc cd) // // Inputs:A,B,C //************************************** #include #include char e; using namespace std; void calculate(); void ask(); int main() { cout << "\t Quadratic Equation Solver\n\t\t by Mauricio Rossi\n\n"; cout << "This program will solve quadratic equations for you.\n"; cout << "Just enter the values of A,B, and C of a qudratic equation.\n"; calculate(); return 0; } void ask(){ cout << "Would you like to solve another equation Y/N?"; cin >> e; if (e == 'y' || e == 'Y'){ calculate(); } if(e == 'n' || e == 'N'){ } else { cout << "Invalid command\n"; system("PAUSE"); } } void calculate(){ double a,b,c,a1,a2,a3,nb,sb,divider,result1,result2,div,div2; cout << "Enter value of A\t"; cin >> a; cout << "Enter value of B\t"; cin >> b; cout << "Enter value of C\t"; cin >> c; nb = -b; sb = pow(b, 2); a1 = -4 * a * c; a2 = sb + a1; a3 = sqrt(a2); result1 = nb - a3; result2 = nb + a3; divider = 2 * a; div = result1 / divider; div2 = result2 / divider; cout << "The answer is:\t(" << div << "," << div2 << ")" << "\n"; ask(); } ```

Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)