unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Edit1: TEdit;
Button3: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private-Deklarationen }
x: integer;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Memo1.Clear;
Edit1.Text := '';
Randomize;
x := Random(100);
Memo1.Lines.Add('Anfangen !!!!!!!!!!')
end;
procedure TForm1.Button1Click(Sender: TObject);
var y : Integer;
begin
y := StrToInt(Edit1.Text);
if y < x then Memo1.Lines.Add(IntToStr(y) + ' Zu Klein')
else if y > x then Memo1.Lines.Add(IntToStr(y) + ' Zu Groß')
else if y = x then Memo1.Lines.Add(IntToStr(y) + ' PERFEKTTTTT!!!!!!!');
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if ord(key)=13 then begin
Form1.Button1Click(self);
Edit1.Text := '';
end;
end;
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if ord(key)=46 then begin
Memo1.Clear;
Memo1.Lines.Add('Anfangen !!!!!!!!!!')
end;
end;
end.