unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Label1: TLabel;
Label2: TLabel;
Button6: TButton;
procedure Button5Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
function t(szam:integer):boolean;
procedure Button3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
x:array[1..15] of integer;
maxp,max:integer;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button5Click(Sender: TObject);
begin
close;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
randomize;
end;
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
StringGrid1.Cells[1,0]:= 'Számok';
for i := 1 to 15 do
begin
x[i]:= random(100)+1;
StringGrid1.Cells[1,i]:=inttostr(x[i]);
StringGrid1.Cells[0,i]:=inttostr(i) + '.';
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var i:integer;
begin
max:=x[1];
for i:=2 to 15 do
begin
if max0 then
begin
a:=maxp-x[i];
form2.Image1.Canvas.MoveTo(i*20+25,190);
form2.Image1.Canvas.lineTo(i*20+25,190-a);
end
else
a:=x[i]-maxp;
form2.Image1.Canvas.MoveTo(i*20+25,190);
form2.Image1.Canvas.lineTo(i*20+25,190-a);
end;
form2.showmodal;
end;
end.