-----------------------------------------------------------------------------------
var num : array 1 .. 6 of int
var number : array 1 .. 6 of int
var tot : int := 0
var finish : boolean
%-----------------------------------------------------------
procedure RandNum ()
var doesrepeat : boolean
randint (num (1), 1, 49)
for cRandNum : 2 .. 6
loop
doesrepeat := false
randint (num (cRandNum), 1, 49)
for cNewRand : 1 .. cRandNum - 1
if num (cRandNum) = num (cNewRand) then
doesrepeat := true
end if
end for
exit when doesrepeat = false
end loop
end for
end RandNum
%-----------------------------------------------------------
procedure ShowNum
locate (9, 2)
put "The Numbers Were: "
locate (10, 2)
color (red)
put num (1), " - " ..
put num (2), " - " ..
put num (3), " - " ..
put num (4), " - " ..
put num (5), " - " ..
put num (6)
finish := true
end ShowNum
%-----------------------------------------------------------
procedure Guess
for locate1 : 3 .. 52 by 5
tot := tot + 1
loop
var doesrepeat : boolean := false
loop
locate (3, 1)
color (255)
put "Choose 6 Numbers (1,49): " ..
drawfillbox (200, 350, 400, 370, white)
get number (tot)
doesrepeat := false
if tot > 1 then
for c1 : 1 .. tot - 1
if number (c1) = number (tot) then
doesrepeat := true
end if
end for
else
exit
end if
exit when doesrepeat = false
end loop
if number (tot) <= 49 then
if tot < 6 then
locate (5, locate1)
put number (tot), " - "
end if
if tot > 5 then
locate (5, locate1)
put number (tot)
end if
exit
end if
end loop
if tot = 6 then
exit
end if
end for
end Guess
%-----------------------------------------------------------
procedure CheckNums
var wrong : int := 0
for count : 1 .. 6
for c1 : 1 .. 6
if num (count) = number (c1) then
wrong := wrong + 1
end if
end for
end for
locate (7, 2)
put "You got: ", (wrong), " right"
end CheckNums
%-----------------------------------------------------------
loop
locate (1, 28)
color (blue)
put "Lotto 649 - Just Imagine"
color (255)
RandNum
Guess
CheckNums
ShowNum
delay (10000)
cls
tot := 0
end loop
-----------------------------------------------------------------------------------
|