Dabeen Park/C /Solvequadraticequation

From Biolecture.org

#include <iostream>

  1. include <iomanip>
  2. include <cmath>
  3. include <cstring>

using namespace std;
int main()
{
    int a, b, c;
    double small_solution, large_solution;

    cout << "Quadratic equation solver";
    cout << "Factor a quadratic equation ax^2 + bx + c = 0 if real roots exist.";

    cout << "Please enter the coefficient a: ";
    cin >> a;
    if(a == 0)
    {
    cout << "This is not a quadratic equation. No factorization is needed." << endl;
    exit(0);
    }
    cout << "Please enter the coefficient b: ";
    cin >> b;
    cout << "Please enter the coefficient c: ";
    cin >> c;
    small_solution = static_cast<double>((-b-sqrt(b^2-(4*a*c)))/(2*a));
    large_solution = static_cast<double>((-b+sqrt(b^2-(4*a*c)))/(2*a));
    if(small_solution == large_solution)
    {
    cout << "The equation has one real root: " << small_solution << endl;
    cout << fixed << showpoint << precision(2);
    cout << "The factorization of the equation is: (x -" << abs(small_solution) << ")^2 = 0" << endl;
    exit(0);
    }
    else if(small_solution is not real number && large_solution is not real number)
    {
    cout << "There is no real root." << endl;
    exit(0);
    }
    else if(small_solution is real number && large_solution is real number)
    {
    cout << "The equation has two real roots." << endl;
    cout << fixed << showpoint << precision(2);
    cout << "The smaller root is " << small_solution << endl;
    cout << "The larger root is " << large_solution << endl;
    cout << "The factorization of the equation is: (x -" << abs(small_solution) << ")(x -" << abs(large_solution) << ") = 0" << endl;
    exit(0);
    }
    return 0;
}