ok after some alterations now it looks like this:
Code:
#include <iostream.h>
#include <math.h>
int main() {
float a,b,c,d,e,f,g;
cout << "*** Program to solve the ecuation AX^2 + BX + C = 0 ***\n"<< "Enter the value of the coefficients.\n";
cout << "A=";
cin >> a;
cout << "B=";
cin >> b;
cout << "C=";
cin >> c;
cout << "*** The equation to solve is:" <<a<<"X^2 + "<<b<<"X + " <<c<<" = 0\n";
d = (b*b - 4*a*c);
e = (-(b));
f = 2*a;
g = e/f;
if (d=0)
cout << "*** The equation has only one real solution. \n" << "The solution is: " << g << "\n";
if (d<0)
cout << "*** The equation has no real solutions.\n";
if (d>0)
cout << "*** The equation has two real solutions.\n" << "The solutions are: " << (-(b) + sqrt(d))/f <<" and " << (-(b) - sqrt(d))/f<<"\n";
return 0;
}
what's troubling me is that if d = 0 (a=1 b=2 c=1), nothing happens, the program just states that *** The equation to solve is 1X^2 + 2X + 1 = 0, completely ignoring my "if (d=0) command