Hi, I just started taking C Language class and my first project is due Friday. Was gonna ask for help cos it seems my whole program is ok except i dont know why the compiler won't let me use the sqrt() function :@
Here is a "copy" of the program:
#include <iostream.h>
int main() {
int 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";
//coeficientes
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 = sqrt(d);
if (d<0)
cout << "*** The equation has no real solutions.\n";
if (d>0)
cout << "*** The equation has two real solutions.\n";
cout << "The solutions are: " << -b + sqrt(d)/f <<"and" << -b - sqrt(d)/f; endl;
if (d=0)
cout << "*** The equation has only one real solution.\n";
cout << "The solution is: " << -b/f; endl;
return 0;
}
Be aware it may be full of error but heck its my first try :/
any help would be greatly appreciated
btw, the proggy im using is Microsoft Visual C++ 6.0



LinkBack URL
About LinkBacks




