Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
SinggahDapur SinggahDapur is offline
Ceriwiser
 
Join Date: Nov 2011
Posts: 348
Rep Power: 14
SinggahDapur mempunyai hidup yang Normal
Default Array dan Matrix, Error....

agan-agan..tolongin dong..

sy buat program perkalian matrix pakai array...di delphi nih

tp error..katanya read memory 0x00000



salahnya dimana ya...




Code:

procedure TForm1.btn1Click(Sender: TObject);
var dim : Integer;
begin
dim := StrToInt(Edit1.Text);
StringGrid1.ColCount := dim;
StringGrid1.RowCount := dim;
StringGrid3.ColCount := dim;
StringGrid3.RowCount := dim;
end;


procedure TForm1.Button1Click(Sender: TObject);
var x,y,w : byte;

dim : Integer;
arr1 : array of array of double;
arr2 : array of array of double;
arrhasil : array of array of double;

begin
dim := StrToInt(Edit1.Text);
SetLength(arr1,dim);
SetLength(arr2,dim);
SetLength(arrhasil,dim);

for y := 0 to dim do
begin
for x := 0 to dim do
begin
arr1[y,x] := StrToFloat(StringGrid1.Cells[y,x]);
arr2[y,x] := StrToFloat(StringGrid1.Cells[y,x]);
end;
end;

for w := 0 to dim do
begin
for y := 0 to dim do
begin
arrhasil[w,y] := 0;
for x := 0 to dim do
begin
arrhasil[w,y] := arrhasil[w,y] + arr1[x,w]*arr2[y,x];
end;
end;
end;

for y := 0 to dim do
begin
for x := 0 to dim do
begin
stringGrid3.Cells[x,y] := FloatToStr(arrhasil[y,x]);
end;
end;

end;





Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 06:49 PM.


no new posts