// solve quadratic equation a x^2 + b x + c = 0 #include #include #include // function that solves quadratic equations void quadratic(double a, double b, double c) { // if b^2 - 4ac < 0, there is no real solution. double solution_1, solution_2, Delta, sqrt_Delta; Delta = MISSING; if (Delta < 0) { cout << "the equation has no real solution" << endl; return; // will not continue } else { sqrt_Delta = sqrt(Delta); // math library function: double sqrt(double x) solution_1 = MISSING; solution_2 = MISSING; cout << "one solution is " << solution_1 << endl; cout << "the other solution is " << solution_2 << endl; } } void main() { double A, B, C; cout << "enter the 3 coefficients of a quadratic equation: " << endl; cin >> A >> B >> C; // e.g. 2.45, -5.55, 2.65 quadratic(A, B, C); getchar(); }