Программирование - это просто
Advertisement
arrow arrow Delphi arrow Delphi (array, SetLength, TListBox)
06.02.2023 .
1:
C#
Delphi
Web-
Excel-
.
Delphi (array, SetLength, TListBox) E-mail
megabax   
28.08.2009 .

Delphi (array, SetLength, TListBox)

.

- . , . Delphi Object Pascal, , :

var My_Array : array[index1..indexN] of BaseType
 

index1...indexN , , Delphi 6, 2Gb. BaseType - .

:

var My_Array : array[0..999] of double;

, 1000 double ( ), 0 999.

, , . N-. , . .

. , . , , . " ", , .

- . , . , , LIFO (Last In First Out, ) FIFO (First In First Out, ).

Delphi, , .

var My_Array : array of BaseType

, - .

SetLength(My_Array,LengthOfArray);

LengthOfArray - .

. , , . SetLength, . :

procedure TfrmDinamicArrayTest.btnCopyAndModifyClick(Sender: TObject);
var DM1, DM2:TIntegerArray; i:integer;
begin
    SetLength(DM1,5);
    for i:=Low(DM1) to High(DM1) do DM1[i]:=5;
    DM2:=DM1;
    DM1[2]:=3;
    ShowArray(DM1,lbArray1);
    ShowArray(DM2,lbArray2);
end;


procedure TfrmDinamicArrayTest.btnCopyAndResizeClick(Sender: TObject);
var DM1, DM2:TIntegerArray; i:integer;
begin
     SetLength(DM1,5);
     for i:=Low(DM1) to High(DM1) do DM1[i]:=5;
     DM2:=DM1;
     SetLength(DM2,7);
     DM1[2]:=3;
     ShowArray(DM1,lbArray1);
     ShowArray(DM2,lbArray2);
end;


procedure TfrmDinamicArrayTest.ShowArray(A:TIntegerArray; L:TListBox);
var i:integer;
begin
     L.Clear;
     for i:=Low(A) to High(A) do L.Items.Add(IntToStr(A[i]));
end;

:

   Delphi (array, SetLength, TListBox)

:

   Delphi (array, SetLength, TListBox)

( 18.02.2013 . )
 
« .
 
© 2023 Программирование - это просто
Joomla! - , GNU/GPL.
© 2005-2008 Joom.Ru - Joomla!
Design by Mamboteam.com | Powered by Mambobanner.de
  .