Autor Beitrag
MJ42
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Fr 12.07.02 21:19 
Hallo alle zusammen,

ich habe vor kurzem mit Delphi angefangen, und habe nun eine kleine Frage:

Wie kann verhindern, dass bei Zufallszahlen, die einem Array[1..6] zugordnet werden, doppelte Zahlen auftauchen?

Gibt es auch eine einfache Möglichkeit, diese Zahlen zu ordnen?

Danke für eure Hilfe!

_________________
MJ42

+-----------------------+
42 - The Great Answer
DBR
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46



BeitragVerfasst: Sa 13.07.02 14:03 
MathiasH
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 699

WinXP, Win98SE, Debian, Win95
D5 Stand, D6 Prof
BeitragVerfasst: Sa 13.07.02 14:09 
zu 2.:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
while not ((a<b) and (b<c) and (c<d) and (d<e) and (e<f)) do begin
 if a>b then begin
  v := a;
  a := b;
  b := v;
 end;
 if b>c then begin
  v := b;
  b := c;
  c := v;
 end; 
 if c>d then begin
  v := c;
  c := d;
  d := v;
 end; 
 if d>e then begin
  v := d;
  d := e;
  e := v;
 end;
 if e>f then begin
  v := e;
  e := f;
  f := v;
 end;
end;


abcdef entspricht den array-values, v ist eine Integer var

MathiasH

_________________
"Viel von sich reden, kann auch ein Mittel sein, sich zu verbergen."
Friedrich Nietzsche