很简单的问题 ,一个函数的调用,不存在?
#include<iostream>#include<string>
#include<cmath.h> //哪里不对?没有这个函数,在DEV C++4.9.9.2里?
using namespace std;
int main()
{
cout<<"Coefficients for quadratic equation: ";
double a;
double b;
double c;
cin>>a>>b>>c;
if((a!=0)&&((b*b-4*a*c)>0)){
double radical=sqrt(b*b-4*a*c); //它说sqrt没有定义,奇怪了
double root1=(-b+radical)/(2*a);
double root2=(-b-radical)/(2*a);
cout<<"The roots of "<<a<<"x**2+"<<b
<<"x+"<<c<<" are "<<root1<<" and "<<
root2<<endl;
}
else {
cout<<"It has no two real roots."<<endl;
}
system("pause");
return 0;
}