Ver Mensaje Individual
  #6  
Antiguo 14-04-2009
Mav Mav is offline
Miembro
 
Registrado: jun 2007
Posts: 39
Reputación: 0
Mav Va por buen camino
Ecuación

Algo así, mas o menos:
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
a,b,c : Integer;
x1,x2,r : Real;
begin
 a:= StrToInt(Edit1.Text);
 b := StrToInt(Edit2.Text);
 c := StrToInt(Edit3.Text);
 if a=0 then
 Edit4.Text:=FloatToStr(-c/b)
     else
    begin
      r:=b*b-4*a*c;
      if r<0 then
      ShowMessage('Error!!!Raiz negativa, el resultado es imaginario')
      else
         begin
           r:= Sqrt(r);
           x1:= (-b+r)/(2*a);
           x2:= (-b-r)/(2*a);
           Edit4.Text:= FloatToStr(x1);
           Edit5.Text:= FloatToStr(x2);
         end;
    end;
end;
...lo tenia a mano de algo que estaba haciendo...
Saludos
Responder Con Cita