Created
September 2, 2016 05:37
-
-
Save ruohki/e5b61b11b41e1f3b9a96a8531c82fc1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare function isValid(array() as integer, number as integer) as byte | |
randomize timer | |
dim zahl as integer | |
dim i as integer | |
dim Zahlen(1 to 4) as integer | |
dim zaehler as integer | |
dim ende as byte | |
do | |
zahl = int((rnd() * 17) + 1) | |
if isValid(Zahlen(), zahl) then | |
zaehler += 1 | |
Zahlen(zaehler) = zahl | |
if zaehler = ubound(Zahlen) then | |
ende = 1 | |
end if | |
end if | |
loop until ende | |
print "Froehliche Hungerspiele" | |
print "Die Gewinnerzahlen sind:" | |
for i = 1 to ubound(Zahlen) | |
print Zahlen(i) | |
sleep 1000 | |
next i | |
print "Herzlichen Glueckwunsch an alle Gewinner, und moege das Glueck stets mit euch sein!" | |
do | |
loop | |
function isValid(array() as integer, number as integer) as byte | |
dim a as integer | |
dim found as boolean | |
for a = lbound(array) to ubound(array) | |
if (array(a) = number) then | |
isValid = 0 | |
exit function | |
end if | |
next | |
isValid = 1 | |
end function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment