c++

来源:互联网 发布:数据分析招聘 泉州 编辑:程序博客网 时间:2024/05/29 08:02

#include <iostream>

#include<cmath>

using namespace  std;

int main()

{

float a, b,c,x1,x2;

cout<<"请输入a,b,c,的值"<<endl;

cin>>a>>b>>c>>endl;

x1=(-b+sqrt(b*b-4*a*c))/(2*a);

x2=(-b-sqrt(b*b-4*a*c)/(2*a);

cout<<"x1="<<x1<<"x2="<<x2<<endl;

return 0 ;

}