unit Mitternachtsformelberechnung;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls, MPlayer;
type
TForm1 =
class(TForm)
Image1: TImage;
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label12: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function plus(a,b,c: Real): Real;
begin
plus:=(-b+(SQRT(b*b-4*a*c)))/(2*a);
end;
function minus(a,b,c: Real): Real;
begin
minus:=(-b-(SQRT(b*b-4*a*c)))/(2*a);
end;
procedure TForm1.Button1Click(Sender: TObject);
var a,b,c,d,e: Real;
begin
Label1.Caption:='
';
Label2.Caption:='
';
a := StrToFloat(Edit1.Text);
b := StrToFloat(Edit2.Text);
c := StrToFloat(Edit3.Text);
if b*b-4*a*c>=0
then
begin
d := plus(a,b,c);
e := minus(a,b,c);
Label1.Caption := FloatToStr(d);
Label2.Caption := FloatToStr(e);
Label12.Caption:='
';
end
else
Label12.Caption:='
Es gibt keine Nullstellen!';
end;
end.