Einzelnen Beitrag anzeigen

youcefdar
(Gast)

n/a Beiträge
 
#5

Re: Nullstellen Berechnung für y=ax²+bx+c

  Alt 29. Sep 2009, 17:49
vorführ Prüfung machen wir immer am NeuenJahresanfang, Ist wie eine Klausur.

Und danke sehr, es scheint hier ja eine sehr nette Community zu sein.

Also hab jetzt mein Threadstart noch mal editiert.

Und ich weiß das mit der Pq Formel^^

Delphi-Quellcode:
procedure TForm2.Button1Click(Sender: TObject);
var a,b,c,Radikand,wurzel,p,q,x1,x2,im,re:real;
begin
  a:=StrToInt(Edit1.Text);
  b:=StrToInt(Edit2.Text);
  c:=StrToInt(Edit3.Text);
  if a=0 then showmessage('Keine quadratische Gleichung');
  try
    p:=b/a;q:=c/a;
  except
     on E : Exception do
     begin
       ShowMessage('Exception class name = '+E.ClassName);
       ShowMessage('Exception message = '+E.Message);
     end;
  end;

  Radikand:=sqr(p/2)-q;

  If Radikand=0 then
  begin
     x1:=-p/2;
     Edit4.Text:= 'x = ' + FloatToStr(-p/2);
     Edit5.Text:='';
     Label6.Caption:='Nur eine Lösung!';
  end;

  If Radikand>0 then
  begin
     x1:=-p/2+sqrt(Radikand);
     x2:=-p/2-sqrt(Radikand);
     Edit4.Text:='x1 = ' + FloatToStr(x1);
     Edit5.Text:='x2 = ' + FloatToStr(x2);
     Label6.Caption:='2 relle Lösungen!';
  end;

  If Radikand<0 then
  begin
      Radikand:=-Radikand;
      re:=-p/2;
      im:=sqrt(Radikand);
      Edit4.Text:=FloatToStr(re) + ' + '+ FloatToStr(im) + ' i';
      Edit5.Text:=FloatToStr(re) + ' - '+ FloatToStr(im) + ' i';
      Label6.Caption:='2 komplexe Lösungen!';
  end;
end;

Und danke für den Linkverweis.
Doch wie müsste von hier aus meine Form aussehen.
Also was bräcuhte ich alles.

Button,Label und Edit kann ich herauslesen, doch wie viele brauch ich von jedem.
Und wie soll es ungefähr aussehen
  Mit Zitat antworten Zitat