回覆列表
  • 1 # 何以笙丶丶

    #include

    #include

    using namespace std;

    class QEquation{

    double a,b,c;

    public:

    QEquation(double x=1, double y=0, double z=-1){

    a=x; b=y; c=z;

    }

    void set_coef(double x, double y, double z){

    a=x; b=y; c=z;

    }

    void solve_equation(){

    double d,x1,x2;

    d=b*b-4*a*c;

    if(d>0){

    d=sqrt(d);

    x1=(-b+d)/(2*a);

    x2=(-b-d)/(2*a);

    cout

    }else if(d==0){

    x1=-b/(2*a);

    cout

    }else

    cout

    }

    };

    int main(){

    QEquation e1,e2(2,4,8),e3;

    e3.set_coef(1,4,4);

    e1.solve_equation();

    e2.solve_equation();

    e3.solve_equation();

    return 0;

    }

  • 中秋節和大豐收的關聯?
  • 第一界世博會是哪一年?