unit beleg;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 =
class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
START: TButton;
ENDE: TButton;
x: TLabel;
Edit5: TEdit;
procedure ENDEClick(Sender: TObject);
procedure STARTClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.ENDEClick(Sender: TObject);
begin
close
end;
FUNCTION FKT(a,b,n,x:real):real;
begin
fkt:=a*exp (- x);
end;
procedure TForm1.STARTClick(Sender: TObject);
var a,b,n,fi,x,y1,ymax: real;
fc,i,int: integer;
begin
a := StrToFloat(Edit1.Text);
b := StrToFloat(Edit2.Text);
if (a<1)
then begin
messagedlg(
'
untere grenze a muss groesser 1 sein!',
mtError,[mbOK],0);
Edit1.setfocus;
exit;
end;
if (b<=a)
then begin
messagedlg(
'
obere grenze b muss groesser untere grenze a sein!',
mtError,[mbOK],0);
Edit2.setfocus;
exit;
end;
for i := 0
to 100
do
begin
int := Random(100);
if (int > a)
and (int < b)
then
begin
y1 := a * exp(int) - int;
end;
end;
begin
i :=Random(100);
if (i>=0)
and (i<ymax)
and (i<=y1)
then
begin
i:=1+random(100);
end;
a:= StrToInt(Edit1.Text);
x:= StrToInt(Edit4.Text);
b:= StrToInt(Edit2.Text);
n:= StrToInt(Edit3.Text);
ymax:=a*exp(b)-b;
fi:=(b-a)*ymax/n;
Edit5.Text := FloatToStr(fi);
Edit5.Text:= Format('
A= %10.3f FE',[fi]);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
randomize;
end;
end.