home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / qpdemo / beispiel / lotto.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-08-24  |  848 b   |  40 lines

  1.  
  2. PROGRAM Lottoblock;
  3.  
  4. USES Crt;
  5.  
  6. VAR i, j, z : Integer;
  7.    L : ARRAY [1..6] OF Integer;
  8.    Kreuz, Neuezahl, Ende : Boolean;
  9.  
  10. BEGIN
  11.   Randomize; { neue Zufallszahlen }
  12.   FOR i:=1 TO 6 DO BEGIN
  13.    REPEAT
  14.      z := Random (49) + 1;     { Zahl zwischen 1 und 49 }
  15.      Neuezahl := True;
  16.      FOR j:=1 TO i DO IF z = L[j] THEN Neuezahl := False
  17.        { ist wahr, wenn z neue Zufallszahl ist }
  18.    UNTIL Neuezahl;
  19.    L[i] := z
  20.   END; { von FOR i }
  21.   ClrScr;
  22.   Writeln ('Die Lottozahlen:');
  23.   Writeln;
  24.   Write ('   ');
  25.   Ende := False;
  26.   i := 10;
  27.   REPEAT
  28.    Kreuz := False;
  29.    FOR j:=1 TO 6 DO IF L[j]=i THEN Kreuz := True;
  30.    IF Kreuz    THEN Write ('  X')
  31.       ELSE Write (i:3);
  32.    IF i >= 49 THEN Ende := True;
  33.    IF i >= 40 THEN BEGIN
  34.          Writeln;
  35.          i := i-39
  36.            END
  37.         ELSE i := i+10
  38.   UNTIL Ende
  39. END.
  40.