Help with formula problem

hi there, I am trying to get this quadratic problem to work.
it is suppose to how many distinct roots there are, and what they are.

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
double a;
double b;
double c;
double root1;
double root2;
double discrim;
double root;

cout << "Program computer and priants real roots \n of a quadratic polynomial: a*x^2 + b*x + c";
cout << "Enter three numbers a, b, and c, separated by spaces" << endl;
cin >> a >> b >> c;

if (a == 0)
if (b == 0)
if(c == 0)
cout << "Degenerate case" << endl;
else
cout << "Inconsistent " << c << endl;
else
{
root = - (c / b);
cout << "Linear case is " << root << endl;
}

else
{
cout << "The quadratic equation " << a << "*x^2 + " << b << "*x + " << c;
discrim = ((b * b) - (4.0 * a * c));
}
if (a != 0)
if (b != 0)
if (c != 0)
if (discrim > 0)
{
root1 = ((- b + sqrt((b * b) - (4.0 * a * c)) / ((2 * a))));
root2 = ((- b - sqrt((b * b) - (4.0 * a * c)) / ((2 * a))));
cout << " has two real roots: " << endl;
cout << "root1 = " << root1 << " and root2 = " << root2 << endl;
}
else
if (discrim == 0) //same for the first two lines
{
root1 = ((- b + sqrt((b * b) - (4.0 * a * c)) / ((2 * a))));
root2 = ((- b - sqrt((b * b) - (4.0 * a * c)) / ((2 * a))));
cout << " has two of the same roots: " << endl;
cout << "root1 = root2 = " << root2 << endl;
}

else
if (discrim < 0)
{
cout << " has complex roots." << endl;
}


return 0;
}

please help!
What's the problem? And please indent and use [code][/code] tags.
Topic archived. No new replies allowed.