谢了啊!
不难的,自己写吧
										
					
	#include<iostream>
#include<math.h>
using namespace std;
class funtion
{
public:
    ~funtion(){cout<<"求解完毕"<<endl;}
    void set_value(); //输入函数
    void display();   //求解函数
    void show_value();//输出函数
private:
    float a;
    float b;
    float c;
    float x1;    
    float x2;
    float r;
    float i;
    float pd;
};
void funtion::set_value ()
{ 
    cout<<"输入 a b c 的值且 a b c 不可全为零"<<endl;
    cin>>a;
    cin>>b;
    cin>>c;
}
void funtion::display ()
{
    pd=b*b-4*a*c;
    if(pd>0)
    {
        x1=-b/(2*a)+sqrt(pd)/(2*a);
        x2=-b/(2*a)-sqrt(pd)/(2*a);
    }
    else if(pd==0)
    {
        x1=-b/(2*a);
        x2=-b/(2*a);
    }
    else
    {
        r=-b/(2*a);
        i=sqrt(-pd)/(2*a);
    }
}
void funtion::show_value ()
{
    
    if(pd>0)
     cout<<"x1="<<x1<<"   "<<"x2="<<x2<<endl;
    else if(pd==0)
        cout<<"x1="<<x1<<"   "<<"x2="<<x2<<endl;
    else
     cout<<"x1="<<r<<'+'<<i<<"i"<<"   "<<"x2="<<r<<'+'<<i<<"i"<<endl;
}
int main()
{
    funtion f;
    f.set_value ();
    f.display ();
    f.show_value ();
    return 0;
}
这样可不可以?是不是太繁了?
