Einzelnen Beitrag anzeigen

Benutzerbild von Chemiker
Chemiker

Registriert seit: 14. Aug 2005
1.858 Beiträge
 
Delphi 11 Alexandria
 
#32

Re: While schleife endlos? oder nicht?

  Alt 5. Apr 2009, 18:53
Hallo JumpFrog,

Delphi-Quellcode:
procedure TfrmLotto.btMeineVersionClick(Sender: TObject);
var
  i, intTip: integer;
  LottoArr: Array[1..49] of Boolean;
begin
  for I := 1 to high(LottoArr) do
  begin
    LottoArr[i]:= FALSE;
  end;
  for I := 1 to 6 do
  begin
    repeat
      intTip:= Random(49)+1;
    until not LottoArr[intTip];
    LottoArr[intTip]:= TRUE;
  end;
  for I := 1 to high(LottoArr) do
  begin
    if LottoArr[i] then // Der Index i ist die Lottozahl
    begin
      ListBox1.Items.Add(inttostr(i));
    end;
  end;
end;
Mal eine andere Version.

Bis bald Chemiker
wer gesund ist hat 1000 wünsche wer krank ist nur einen.
  Mit Zitat antworten Zitat