Zitat von
freak4fun:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
i, j, y: Integer;
begin
y := StrToInt(Edit1.Text);
for i := Low(MyArray) to High(MyArray) do
for j := Low(MyArray) to High(MyArray) do
if MyArray[i] + MyArray[j] = y then
ListBox1.Items.Add(Format('I: %d J: %d', [i, j]));
end;
MfG
freak
Man darf doch nicht eines mit sich selbst addieren, oder?
Also:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
i, j, y: Integer;
begin
y := StrToInt(Edit1.Text);
for i := Low(MyArray) to High(MyArray) do
for j := Low(MyArray) to High(MyArray) do
if (MyArray[i] + MyArray[j] = y) and (i<>j) then
ListBox1.Items.Add(Format('I: %d J: %d', [i, j]));
end;
Oder sehe ich da was falsch?