Professional Documents
Culture Documents
Sintak Array Pada Delphi Xe8
Sintak Array Pada Delphi Xe8
NPM : 5520117111
Tugas Pemrograman Destop “Array”
unit ArrayToriqs;
interface
uses
type
TForm_OPMatrik = class(TForm)
Label1: TLabel;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
GroupBox4: TGroupBox;
GroupBox1: TGroupBox;
Label2: TLabel;
Label3: TLabel;
GroupBox5: TGroupBox;
txt_BrsM_A: TEdit;
Txt_Klm_A: TEdit;
cmd_BuatMatrik: TButton;
cmd_keluar: TButton;
CMD_Jumlah: TButton;
cmd_Kali: TButton;
Cmd_Kurang: TButton;
StringGrid1: TStringGrid;
StringGrid2: TStringGrid;
StringGrid3: TStringGrid;
procedure cek_Kolom;
procedure bersih;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_OPMatrik: TForm_OPMatrik;
implementation
{$R *.dfm}
var kol,brs:integer;
begin
brs:=StrToIntDef(txt_BrsM_A.Text,0);
kol:=StrToIntDef(Txt_Klm_A.Text,0);
StringGrid1.RowCount:=brs+1;
StringGrid1.ColCount:=kol+1;
StringGrid2.RowCount:=brs+1;
StringGrid2.ColCount:=kol+1;
StringGrid3.RowCount:=brs+1;
StringGrid3.ColCount:=kol+1;
end;
procedure TForm_OPMatrik.cek_Kolom;
begin
begin
txt_BrsM_A.SetFocus;
txt_BrsM_A.Text:='';
Txt_Klm_A.Text:='';
txt_BrsM_A.Text:='5';
Txt_Klm_A.Text:='5';
end;
end;
procedure TForm_OPMatrik.bersih;
var i,j:integer;
begin
for i := 1 to StrToInt(txt_BrsM_A.Text) do
begin
for j := 1 to StrToInt(Txt_Klm_A.Text) do
begin
stringgrid1.Cells[j,i] := '0';
stringgrid2.Cells[j,i] := '0';
stringgrid3.Cells[j,i] := '0';
end;
end;
end;
var
i,j,b,k : integer;
MatrikA:array[1..10,1..10] of integer;
MatrikB:array[1..10,1..10] of integer;
hasil:array[1..10,1..10] of integer;
begin
b:=StrToInt(txt_BrsM_A.Text);
k:=StrToInt(Txt_Klm_A.Text);
for i := 1 to b do
begin
for j := 1 to k do
begin
MatrikA[i,j]:=StrToInt(StringGrid1.Cells[j,i]);
MatrikB[i,j]:=StrToInt(StringGrid2.Cells[j,i]);
StringGrid3.Cells[i,j] := inttostr(Hasil[i,j]);
end;
end;
end;
var
i,j,b,k : integer;
MatrikA:array[1..10,1..10] of integer;
MatrikB:array[1..10,1..10] of integer;
hasil:array[1..10,1..10] of integer;
begin
b:=StrToInt(txt_BrsM_A.Text);
k:=StrToInt(Txt_Klm_A.Text);
for i := 1 to b do
begin
for j := 1 to k do
begin
MatrikA[i,j]:=StrToInt(StringGrid1.Cells[j,i]);
MatrikB[i,j]:=StrToInt(StringGrid2.Cells[j,i]);
StringGrid3.Cells[i,j] := inttostr(Hasil[i,j]);
end;
end;
end;
begin
Application.Terminate;
end;
var
i,j,b,k : integer;
MatrikA:array[1..10,1..10] of integer;
MatrikB:array[1..10,1..10] of integer;
hasil:array[1..10,1..10] of integer;
begin
b:=StrToInt(txt_BrsM_A.Text);
k:=StrToInt(Txt_Klm_A.Text);
for i := 1 to b do
begin
for j := 1 to k do
begin
MatrikA[i,j]:=StrToInt(StringGrid1.Cells[j,i]);
MatrikB[i,j]:=StrToInt(StringGrid2.Cells[j,i]);
StringGrid3.Cells[i,j] := inttostr(Hasil[i,j]);
end;
end;
end;
end.