#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double a, b, c, x1, x2, p, q;
cout << "Please input a, b, c:" << endl;
cin >> a >> b >> c;
p = -b / (2 * a);
q = sqrt(b * b - 4 * a * c) / (2 * a);
x1 = p + q;
x2 = p - q;
cout << "x1=" << x1 << endl;
cout << "x2=" << x2 << endl;
return 0;
}
求解一元二次方程
最新推荐文章于 2024-08-19 18:41:12 发布