A simple program to calculate quadratic equation with.

Input MUST have the format:

**AX**^{2} + BX + C = 0
EXAMPLE: input the equation

** 2X**^{2} + 4X -30 = 0 as:

**A= 2 B= 4 C= -30**
The answers for

**AX**^{2} + BX + C = 0 should be

**3 **and

**-5**.

x

**1=3**
**x2=-5**
bool solver(float a,float b, float c, float &x1, float &x2)
{
float delta = sqrt( (b*b) - (4*a*c) );
if (!a) return false;
x1 = ( -b + delta)/(2*a);
x2 = ( -b - delta)/(2*a);
return true;
}
int main()
{
float a=2,
b=4,
c=-30;
float x1,x2;
if ( solver(a, b ,c, x1, x2) ) printf("x1=%f\nx2=%f\n",x1,x2);
return 0;
}

...