Arsip: convert array dari vb ke delphi

 
user image
more 12 years ago

diandewi

halo...saya lg convert coding dari vb ke delphi tp saya sdkit bingung dengan arraynya. saya sudah buat codingnya di delphi sepeerti ini, kira2 yang salah dmn ya? mohon bantuannya
while (iter<= maxiter) do
  begin
    for i := 1 to 10 do
      begin
          for k := 1 to klaster do
            begin
              d (k):=0;
             tempd ( k ):= 0;
              for j := 0 to  10 do
                begin
                  tempd ( k ) = tempd ( k ) + sqr( x (i, j) - w ( k, j)) ;
                end;
                d = Sqrt(tempd(k));
user image
more 12 years ago

ianhade

coba gunakan ":=" (tanpa kutip) untuk mengisi nilai ke variabel array dan gunakan tanda "" (tanpa kutip) untuk index array
user image
more 12 years ago

diandewi

kayak gini ya maksudnya? tapi tetep error dy, errornya kayk gini: [DCC Error] lvq.pas(133): E2066 Missing operator or semicolon [DCC Error] lvq.pas(133): E2016 Array type required
while (iter<= maxiter) do
  begin
    for i := 1 to 10 do
      begin
          for k := 1 to klaster do
            begin
              d (k):=0;
             tempd ( k ):= 0;
              for j := 0 to  10 do
                begin
                  tempd ( k ) := tempd ( k ) + sqr( x [i, j] - w [ k, j]) ;
                end;
                d := Sqrt(tempd(k));
            end;
user image
more 12 years ago

hendrang67

@diandewi: kayak gini ya maksudnya? tapi tetep error dy, errornya kayk gini: [DCC Error] lvq.pas(133): E2066 Missing operator or semicolon [DCC Error] lvq.pas(133): E2016 Array type required
while (iter<= maxiter) do
  begin
    for i := 1 to 10 do
      begin
          for k := 1 to klaster do
            begin
              d (k):=0;
             tempd ( k ):= 0;
              for j := 0 to  10 do
                begin
                  tempd ( k ) := tempd ( k ) + sqr( x [i, j] - w [ k, j]) ;
                end;
                d := Sqrt(tempd(k));
            end;
d dan tempd juga array kan ? kalau array indexnya juga pakai while (iter<= maxiter) do begin for i := 1 to 10 do begin for k := 1 to klaster do begin d [k]:=0; tempd [k]:= 0; for j := 0 to 10 do begin tempd[k]:= tempd[k] + sqr( x [i, j] - w [k, j]) ; end; d := Sqrt(tempd[k]); //<-- cek variabel d kalau array juga harus ada index nya end;
user image
more 12 years ago

diandewi

ok...makasi... oiya kalo saya mau ngambil nilai dari masing2 karakter array ini ref : array of string = (('0','1','0','1','0','1','0','1','0','1'),('1','0','1','0','1','0','1','0','1','0')); coding yang bener kyk gmn ya? saya sblumnya buat kayak gini for j := 1 to Length(ref(i));
more ...
  • Pages:
  • 1
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com