unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
BtnInz: TButton;
Btnerz: TButton;
BtnEnde: TButton;
BtnAnz: TButton;
BtnGro: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
ListBox1: TListBox;
Label1: TLabel;
procedure BtnEndeClick(Sender: TObject);
procedure BtnInzClick(Sender: TObject);
procedure BtnerzClick(Sender: TObject);
procedure BtnAnzClick(Sender: TObject);
procedure BtnGroClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Feld:
array[0..5]
of integer;
implementation
{$R *.dfm}
procedure TForm1.BtnAnzClick(Sender: TObject);
var
i:integer;
begin
for i := 0
to 5
do
begin
Edit1.Text:=inttostr(Feld[0]);
Edit2.Text:=inttostr(Feld[1]);
Edit3.Text:=inttostr(Feld[2]);
Edit4.Text:=inttostr(Feld[3]);
Edit5.Text:=inttostr(Feld[4]);
Edit6.Text:=inttostr(Feld[5]);
end;
end;
procedure TForm1.BtnEndeClick(Sender: TObject);
begin
close;
end;
procedure TForm1.BtnerzClick(Sender: TObject);
var
i,a,c,LoZahl:Integer;
begin
a:=0;
i:=0;
c:=0;
while i<=5
do // Schleifenbegin für 6 Ziehungen
begin
LoZahl:=random(48)+1;
Feld[a]:=LoZahl;
ListBox1.Items.Add(floattostr(Feld[a]));
while c<=5
do
begin
while Feld[a]= LoZahl
do
LoZahl:=random(48)+1;
c:=c+1;
end;
a:=a+1;
i:=i+1;
end;
end;
procedure TForm1.BtnGroClick(Sender: TObject);
var
x,a,i,zahl:Integer;
begin
x:=0;
a:=0;
zahl:=0;
while x<=5
do
begin
If Feld[a]>=10
then
begin
zahl:=zahl+1;
a:=a+1;
x:=x+1;
end
else
x:=x+1;
end;
Label1.Caption:=inttostr(zahl);
end;
procedure TForm1.BtnInzClick(Sender: TObject);
begin
edit1.Clear;
Edit2.Clear;
Edit3.Clear;
Edit4.Clear;
Edit5.Clear;
Edit6.Clear;
end;
end.