Einzelnen Beitrag anzeigen

Siggy

Registriert seit: 25. Okt 2008
20 Beiträge
 
#4

Re: Frage zu Lottozahlengenerator

  Alt 1. Mai 2009, 13:09
Ich hatte erst eine Lösung die auch funktioniert hat.
Die sah so aus:

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
a,b,c,d,e,f :integer;
begin
randomize;
repeat
  a:= random (49);
  b:= random (49);
  c:= random (49);
  d:= random (49);
  e:= random (49);
  f:= random (49);

until (a<>b) and (a<>c) and (a<>d) and (a<>e) and (a<>f)
and (b<>c) and (b<>d) and (b<>e) and (b<>f)
and (c<>d) and (c<>d) and (c<>f)
and (d<>e) and (d<>f)
and (e<>f);


edit1.Text := inttostr (a);
edit2.Text := inttostr (b);
edit3.Text := inttostr (c);
edit4.Text := inttostr (d);
edit5.Text := inttostr (e);
edit6.Text := inttostr (f);

Die auch funktioniert hat...
Allerdings ist die ja sehr unschön und ein ewig langer Text...
Unser Lehrer hat gemeint, dass wir das mit Arrays lösen sollen, allerdings hab ich davon keine Ahnung und daher hab ich hier gefragt ob mir das jemand anhand meines Lottogenerators erklären könnte.


Siggy
  Mit Zitat antworten Zitat