用c++解 输入a、b、c求一元二次方程ax^2+bx+c=0的两个实数根(不考虑无解的情况)。

日期:2018-02-22 21:54:23 人气:1

用c++解 输入a、b、c求一元二次方程ax^2+bx+c=0的两个实数根(不考虑无解的情况)。

c++ 输出格式定义繁琐,我们可以用 c 的printf()方式输出。 #include using namespace std; #include #include int main(){ double a,b,c,d,x1,x2; cout << "input a b c" << endl; cin >> a >> b >> c; d = b*b - 4 * a *c; if (d<0)
    A+
热门评论