I'm having issues with the code below:
#include<iostream>
#include<fstream>
#include<cmath>
using namespace std;
int main()
{
    ifstream fin("input.txt");
    ofstream fout("output.txt");
    float discriminant, A, B, C, root1, root2;
    fin >> A >> B >> C;
    while (A != -99)
    {
        discriminant = (pow(B, 2.0) - 4 * A*C);
        if (A == 0)
        {
            fout << A << "\t" << B << "\t" << C << "\t" << root1 << "\t" << root2 << endl;
        }
        else if (discriminant > 0)
        {
            root1 = (-B - sqrt(discriminant)) / (2.0*A);
            root2 = (-B + sqrt(discriminant)) / (2.0*A);
            fout << A << "\t" << B << "\t" << C << "\t" << root1 << "\t" << root2 << endl;
        }
        else if (discriminant == 0)
        {
            fout << A << "\t" << B << "\t" << C << "\t" << root1 << "\t" << root2 << endl;
        }
        else
        {
            fout << A << "\t" << B << "\t" << C << "\t" << root1 << "\t" << root2 << endl;
        }
        fin >> A >> B >> C;
    }
    fout.close();
    ifstream fin2("output.txt");
    fin2 >> A >> B >> C >> root1 >> root2;
    while (!fin2.eof())
    {
        cout << A << "\t" << B << "\t" << C << "\t" << root1 << "\t" << root2 << endl;
        fin2 >> A >> B >> C >> root1 >> root2;
    }
    cout << endl;
    cout << "Coded by Paye W. Kialain" << "\t"<< endl;
    system("pause");
    return 0;
}
In the project description, I was told to create an input file containing a, b, and c, which I did. The format of the output is also correct. It is a table displaying the a, b and c values along with the 2 calculated roots. However, the calculations of the roots seem to be off. Are my if statements the issue?
 
     
    