cmath 函数的 sqrt();
#include
#include
using namespace std;
void f(double a,double b,double c)
{
double r1,r2;
if(bb>4ac&&a)
{
r1=((-1)b+sqrt(bb-4ac))/2a;
r1=((-1)b-sqrt(bb-4ac))/2*a;
}
cout<<“r1=”<<r1<<endl;
cout<<“r2=”<<r2;
}
int main()
{
double a,b,c;
cin>>a>>b>>c;
f(a,b,c);
}
来源:CSDN
作者:乐多
链接:https://blog.csdn.net/weixin_44769592/article/details/103484710