Tuesday, April 14, 2009

Tugas Algoritma dan Struktur Data 01 Lab. B Revisi 1



Gambar tersebut di atas adalah tampilan interfacenya
Keterangan
Kiri atas : Input
Kiri Bawah : Output
Kanan Atas : Matriks A
Kanan Bawah: Matriks B


Sedangkan untuk listing programnya adalah sebagai berikut:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Grids;

type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
GroupBox1: TGroupBox;
Edit1: TEdit;
Edit2: TEdit;
BitBtn1: TBitBtn;
Label1: TLabel;
Label2: TLabel;
StringGrid2: TStringGrid;
StringGrid3: TStringGrid;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);
begin

StringGrid1.ColCount:=strtoint(edit1.Text)+1;
StringGrid1.RowCount:=strtoint(edit2.Text)+1;
StringGrid2.ColCount:=strtoint(edit1.Text)+1;
StringGrid2.RowCount:=strtoint(edit2.Text)+1;
StringGrid3.ColCount:=strtoint(edit1.Text)+1;
StringGrid3.RowCount:=strtoint(edit2.Text)+1;

end;

procedure TForm1.BitBtn2Click(Sender: TObject);
var i,j:integer;
begin

for i:=1 to StrToInt(Edit1.Text) do
begin
for j:=1 to StrToInt(Edit2.Text) do
begin
StringGrid3.Cells[i,j]:=IntToStr(StrToInt(StringGrid1.Cells[i,j])+StrToInt(StringGrid2.Cells[i,j]));

end;
end;
end;
end.


NB: listing program boleh sama asal tampilan interfacenya dibuat se-kreatif mungkin ^^

Special thanks to S'Kib and Fendy...

5 comments:

Taro Misakib said...

wah special thankz salah. haruse Skib's and kahfi.
more special to 222

Anonymous said...

wew

HenQ said...
This comment has been removed by the author.
HenQ said...

Halah

Anonymous said...

sip sip ^^

saben ono tgas dkirm trs yo...hehe^^

Post a Comment

Kalau berkenan, dikoment donk untuk menjadi masukan buad Admin