unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids;
type
TForm1 =
class
(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Memo1: TMemo;
StringGrid1: TStringGrid;
Label1: TLabel;
Label2: TLabel;
Button2: TButton;
Button3: TButton;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
procedure
Button1Click(Sender: TObject);
procedure
Button2Click(Sender: TObject);
procedure
Button3Click(Sender: TObject);
private
public
end
;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure
TForm1
.
Button1Click(Sender: TObject);
var
a:
array
[
0..19
]
of
integer
;
P:
integer
;
i:
integer
;
c,d:
real
;
begin
randomize;
for
i:=
0
to
19
do
begin
a[i]:=random(
50
--
50
+
1
)-
50
;
StringGrid1
.
Cells[i,
0
]:=InttoStr(a[i]);
end
;
P:=
1
;
c:=StrtoInt(Edit1
.
Text);
d:=StrtoInt(Edit2
.
Text);
for
i:=
0
to
19
do
if
(a[i]>=c)
and
(a[i]<=d)
and
(a[i]>
0
)
then
P:=P*a[i];
Memo1
.
Lines
.
Add(FormatFloat(
'0.00'
,P));
end
;
procedure
TForm1
.
Button2Click(Sender: TObject);
begin
memo1
.
Clear;
Edit1
.
Clear;
Edit2
.
Clear;
end
;
procedure
TForm1
.
Button3Click(Sender: TObject);
begin
Form1
.
Close;
end
;
end
.