/已经在vc6下运行过,如果只为了求解上面的这一个方程组,可简化掉参数输入
#include<iostream>
using namespace std;
int main()
{
double x[2],y[2];
double a,b,c,d,m,n;
cout<<"方程组形式如下:ax+by=m;cx*dy=n;"<<endl
<<"请依次输入相关参数:"<<endl;
cout<<"a= "; cin>>a;
cout<<"b= "; cin>>b;
cout<<"m= "; cin>>m;
cout<<"c= "; cin>>c;
cout<<"d= "; cin>>d;
cout<<"n= "; cin>>n;
double tmp = m*m-(4*a*b*n)/(c*d);
if(tmp<0)
cout<<"方程组无解;"<<endl;
else
if(tmp == 0)
{
x[0]=m/(2*a);
x[1]=x[0];
y[0]=n/(c*d*x[0]);
y[1]=y[0];
cout<<"x0=x1="<<x[0]<<ends<<"y0=y1="<<y[0]<<endl;
}
else
{
x[0]=(m+tmp)/(2*a);
x[1]=(m-tmp)/(2*a);
y[0]=n/(c*d*x[0]);
y[1]=n/(c*d*x[1]);
cout<<"x0="<<x[0]<<ends<<"y0="<<y[0]<<endl
<<"x1="<<x[1]<<ends<<"y1="<<y[1]<<endl;
}
return 0;
}