unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Edit1: TEdit;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit2: TEdit;
RadioGroup1: TRadioGroup;
RadioGroup2: TRadioGroup;
Label13: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1; passworttrue: boolean; passwort, eingabe:
string; n, m, k : integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
passwort := '
123456';
eingabe:= edit1.Text;
passworttrue := (passwort=eingabe);
if passworttrue
then
begin
label1.Visible:= true;
label2.Visible:= true;
label3.Visible:= true;
edit2.Visible:= true;
end;
randomize;
k := random(1000)+1;
case RadioGroup1.ItemIndex
of
0:
begin
label2.caption:= '
+';
if radiogroup2.ItemIndex=0
then
begin
REPEAT
n := random(100) +1; m:= random(100) +1;
UNTIL m+n <=100;
end;
if radiogroup2.ItemIndex=1
then
begin
REPEAT
n := random(1000)+1; m:= random(1000) +1;
UNTIL m+n <=1000;
end;
label1.Caption := floattostr(n);
label3.Caption := floattostr(m);
end;
1:
begin
label2.caption:= '
-';
if radiogroup2.ItemIndex=0
then
begin
REPEAT
n := random(100) +1; m:= random(100) +1;
UNTIL n>m;
end;
if radiogroup2.ItemIndex=1
then
begin
REPEAT
n := random(1000)+1; m:= random(1000) +1;
UNTIL n>m;
end;
label1.Caption := floattostr(n);
label3.Caption := floattostr(m);
end;
2:
begin
label2.caption:= '
x';
if radiogroup2.ItemIndex=0
then
begin
REPEAT
n := random(100) +1; m:= random(100) +1;
UNTIL n*m <=100;
end;
if radiogroup2.ItemIndex=1
then
begin
REPEAT
n := random(1000)+1; m:= random(1000) +1;
UNTIL n*m <= 1000;
end;
label1.Caption := floattostr(n);
label3.Caption := floattostr(m);
end;
3:
begin
label2.caption:= '
:';
if radiogroup2.ItemIndex=0
then
begin
REPEAT
n := random(100) +1; m:= random(100) +1;
UNTIL (n>=m)
and (n/m = k);
end;
if radiogroup2.ItemIndex=1
then
begin
REPEAT
n := random(1000)+1; m:= random(1000) +1;
UNTIL (n>=m)
and (n/m = k);
end;
label1.Caption := floattostr(n);
label3.Caption := floattostr(m);
end;
end;
end;
end.