Autor Beitrag
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Fr 19.05.06 07:49 
Hallo,

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
arr : array of integer;

//Array füllen
procedure TForm1.Button2Click(Sender: TObject);
var i:integer;
begin
        SetLength(arr,5);
        for i := 0 to High(arr) do
        begin
               arr[i]:=(i*2);
        end;
        ShowData;
end;

//ShowData
procedure ShowData;
var i:integer;
begin
        for i := 0 to High(arr) do
        begin
                form1.memo1.lines.add(inttostr(i));
        end;
end;

Aber im memo erscheinen die Zahlen 0,1,2,3,4 :confused: Eigentlich sollten doch dort die Zahlen 0,2,4,6,8 auftreten :gruebel:
Woran liegts?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Fr 19.05.06 07:50 
:autsch:
Hab den Fehler gefunden:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
arr : array of integer;

//Array füllen
procedure TForm1.Button2Click(Sender: TObject);
var i:integer;
begin
        SetLength(arr,5);
        for i := 0 to High(arr) do
        begin
               arr[i]:=(i*2);
        end;
        ShowData;
end;

//ShowData
procedure ShowData;
var i:integer;
begin
        for i := 0 to High(arr) do
        begin
                form1.memo1.lines.add(inttostr(arr[i]));
        end;
end;

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot