Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, Grids;
- type
- TForm1 = class(TForm)
- Button1: TButton;
- StringGrid1: TStringGrid;
- Button2: TButton;
- Label1: TLabel;
- Button3: TButton;
- Label2: TLabel;
- Button4: TButton;
- procedure Button4Click(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- dvojpole:array[1..100,1..100] of integer;
- i,j:integer;
- implementation
- {$R *.dfm}
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- randomize;
- label1.caption:='';
- label2.Caption:='';
- for i := 1 to 10 do
- begin
- for j := 1 to 10 do
- begin
- dvojpole[i,j]:=random(100)+1; //NAPLNENIE POLA VO VNUTRI, KTORE EŠTE NEVIDNO
- StringGrid1.Cells[i,j]:=IntToStr(dvojpole[i,j]); //VONKAJSIE NAPLNENIE tStringGrid tabuľky
- end;
- end;
- end;
- procedure TForm1.Button2Click(Sender: TObject);
- var
- max,pozi,pozj:integer;
- begin
- //if dvojpole[0,0] then ;
- max:=0;
- for i := 1 to 10 do
- begin
- for j := 1 to 10 do
- begin
- if max<dvojpole[i,j] then
- begin
- max:=dvojpole[i,j];
- pozi:=i;
- pozj:=j;
- end;
- end;
- end;
- label1.Caption:=('Najväčšie číslo je: '+inttostr(max)+'. Na pozícii: '+'['+inttostr(pozi)+','+inttostr(pozj)+']');
- end;
- procedure TForm1.Button3Click(Sender: TObject);
- begin
- label2.Caption:='Na pozícii [8,2] je číslo: '+(inttostr(dvojpole[8,2]));
- end;
- procedure TForm1.Button4Click(Sender: TObject);
- var
- pozx,pozy:integer;
- begin
- i:=1;
- for i := 1 to 10 do
- begin
- for j := 1 to 10 do
- begin
- pozx:=i*j;
- pozy:=i*j;
- // inc(i);
- end;
- end;
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- for I := 1 to 10 do
- begin
- StringGrid1.Cells[0,i]:=IntToStr(i);
- StringGrid1.Cells[i,0]:=IntToStr(i);
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment