Friday, 20 June 2014
Cara Membuat Program Array
PROGROM ARRAY
Buat Form seperti di atas..
Listing Program Untuk Button Input:
procedure TForm1.btninputClick(Sender: TObject);
Var i:integer;
Nama1,nama2 :array[1..5] of string;
S: string;
begin
s:= inputbox('Input Data','Masukkan Jumlah Data :','0');
for i:= 1 to strtoint(s) do
begin
nama1[i]:= inputbox('Data Ke:'+inttostr(i),'Nama Awal',' ');
nama2[i]:= inputbox('Data Ke:'+inttostr(i),'Nama Belakang',' ');
Lbdata.ITEMS.ADD(NAMA1[I]+ ' ' +NAMA2[I]);
EDIT1.Text:= INTTOSTR (Lbdata.Items.COUNT);
END;
end;
Var i:integer;
Nama1,nama2 :array[1..5] of string;
S: string;
begin
s:= inputbox('Input Data','Masukkan Jumlah Data :','0');
for i:= 1 to strtoint(s) do
begin
nama1[i]:= inputbox('Data Ke:'+inttostr(i),'Nama Awal',' ');
nama2[i]:= inputbox('Data Ke:'+inttostr(i),'Nama Belakang',' ');
Lbdata.ITEMS.ADD(NAMA1[I]+ ' ' +NAMA2[I]);
EDIT1.Text:= INTTOSTR (Lbdata.Items.COUNT);
END;
end;
Listing Program Untuk Button Clear:
procedure TForm1.btnclearClick(Sender: TObject);
begin
Lbdata.clear;
EDIT1.Text:=' ';
end;
begin
Lbdata.clear;
EDIT1.Text:=' ';
end;
Listing Program Untuk Button
procedure TForm1.btncloseClick(Sender: TObject);
begin
halt;
end;
begin
halt;
end;