Arrays: Difference between revisions
Content added Content deleted
Line 1,641:
procedure TForm1.Button1Click(Sender: TObject);
var
StaticArray: array[
DynamicArray: array of Integer; // dynamic arrays always start at 0
StaticArrayText,
DynamicArrayText: string;
begin
// Setting the length of the dynamic array the same as the static one
SetLength(DynamicArray, Length(StaticArray));
// Asking random numbers storing into the static array
for
begin
StaticArray[
InputBox('Random number',
'Enter a random number for position',
IntToStr(
end;
// Storing entered numbers of the static array in reverse order into the dynamic
ixD := High(DynamicArray);
for lcv := 0 to Pred(Length(StaticArray)) do▼
for ixS
// Concatenating the static and dynamic array into a single string variable▼
begin
Dec(ixD);
DynamicArrayText := DynamicArrayText + IntToStr(DynamicArray[lcv]);▼
end;
▲ // Concatenating the static and dynamic array into a single string variable
StaticArrayText := '';
StaticArrayText := StaticArrayText + IntToStr(StaticArray[ixS]);
DynamicArrayText := '';
for ixD := Low(DynamicArray) to High(DynamicArray) do
end;
// Displaying both arrays (#13#10 = Carriage Return/Line Feed)
|