Einzelnen Beitrag anzeigen

-lx-
(Gast)

n/a Beiträge
 
#8

Re: Quadratische und Lineare Funktion

  Alt 31. Okt 2005, 18:13
Hallo...


zu der Quadratischen Funktion habe ich eine Frage:

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Ea: TEdit;
    Eb: TEdit;
    Ec: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  a,b,c,x1,x2: Real ;


implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
a:= StrToFloat(Ea.Text) ;
b:= StrToFloat(Eb.Text) ;
c:= StrToFloat(Ec.Text) ;


  x1:= ( (-b) + (sqrt( (b*b) - (4 * a * c))) ) / (2 * c) ;
  x2:= ( (-b) - (sqrt( (b*b) - (4 * a * c))) ) / (2 * c) ;

ShowMessage('FloatToStr(x1) ; FloatToStr(x2)') ;

end;

end.
Und zwar sobald ich die Werte eingebe und diese Prozedur aufrufe, sagt er: "Ungültiger Gleitkommaopperand" .

Ich weis nicht Recht wo der Fehler liegen kann...


mfg
Cya
  Mit Zitat antworten Zitat