Edit1X+Edit2Y=Edit3
X+Y=Edit4/Edit5
button1
X=Edit6
Y=Edit7
先使得Edit2的值与Edit5的值一致
Edit5.Text=Edit2.Text;
Edit2.Text=Edit5.Text;
procedure TForm1.Button1Click(Sender: TObject);
var
a,b,w,l:double;
x,y:double;
begin
a:=StrToFloat(Edit1.Text);
b:=StrToFloat(Edit2.Text);
w:=StrToFloat(Edit3.Text);
l:=StrToFloat(Edit4.Text);
if(b=0) then
begin
MessageDlg('b为0,无解.', mtInformation,[mbOk], 0);
Edit2.Text:='';
end
else if (a=b) then
begin
if (b*w=l) then
begin
MessageDlg('无穷解.', mtInformation,[mbOk], 0);
end
else
MessageDlg('此方程无解.', mtInformation,[mbOk], 0);
end
else
begin
x:=(w-l)/(a-b);
y:=l/b-x;
Edit6.Text:=FloatToStr(x);
Edit7.Text:=FloatToStr
;
end ;
end;
end.