interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
Tfrminput = class(TForm)
Label1: TLabel;
einput: TEdit;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
lb1: TListBox;
lb2: TListBox;
lb3: TListBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frminput: Tfrminput;
implementation
{$R *.dfm}
procedure Tfrminput.Button1Click(Sender: TObject);
var
i:integer;
n:integer;
begin
n:=strtoint(einput.text);
lb1.Items.Clear;
lb2.Items.Clear;
lb3.Items.Clear;
for i:=1 to n do
begin
lb1.Items.add(inttostr(i));
if i mod 2 =0 then
lb2.items.add(inttostr(i))
else
if i mod 2 =1 then
lb3.items.add(inttostr(i))
end;
end;
procedure Tfrminput.Button3Click(Sender: TObject);
begin
close;
end;
procedure Tfrminput.Button2Click(Sender: TObject);
begin
lb1.Items.Clear;
lb2.Items.Clear;
lb3.Items.Clear;
einput.text:='';
einput.SetFocus;
end;
end.
0 komentar:
Posting Komentar