Const N = 20; Var A:array[1..N] of byte; type Form1 = class(Form) procedure button1_Click(sender: Object; e: EventArgs); procedure button2_Click(sender: Object; e: EventArgs); {$region FormDesigner} private {$resource Unit1.Form1.resources} button1: Button; button2: Button; label1: &Label; {$include Unit1.Form1.inc} {$endregion FormDesigner} public constructor; begin InitializeComponent; end; end;
implementation
procedure Form1.button1_Click(sender: Object; e: EventArgs); Var i:byte; begin Randomize; label1.Text:=''; For i:= 1 to N do Begin A[i]:=PABCSystem.Random(90)+10; label1.Text+=A[i]+' '; End end;
procedure Form1.button2_Click(sender: Object; e: EventArgs); Var i:byte; begin label1.Text:=''; For i:= 1 to N div 5 do A[i*5]:=1; For i:= 1 to N do label1.Text+=A[i]+' '; end; end.
Unit Unit1;
interface
uses System, System.Drawing, System.Windows.Forms;
Const
N = 20;
Var
A:array[1..N] of byte;
type
Form1 = class(Form)
procedure button1_Click(sender: Object; e: EventArgs);
procedure button2_Click(sender: Object; e: EventArgs);
{$region FormDesigner}
private
{$resource Unit1.Form1.resources}
button1: Button;
button2: Button;
label1: &Label;
{$include Unit1.Form1.inc}
{$endregion FormDesigner}
public
constructor;
begin
InitializeComponent;
end;
end;
implementation
procedure Form1.button1_Click(sender: Object; e: EventArgs);
Var
i:byte;
begin
Randomize;
label1.Text:='';
For i:= 1 to N do
Begin
A[i]:=PABCSystem.Random(90)+10;
label1.Text+=A[i]+' ';
End
end;
procedure Form1.button2_Click(sender: Object; e: EventArgs);
Var
i:byte;
begin
label1.Text:='';
For i:= 1 to N div 5 do
A[i*5]:=1;
For i:= 1 to N do
label1.Text+=A[i]+' ';
end;
end.