
-----------------------------------
Flikerator
Thu Apr 28, 2005 8:37 pm

Excluding numbers
-----------------------------------
the second for statement. I need it so if the first number entered can't happen again. Anyone know how to do that? Ill work on the rest but I need this for the program to work. 

var num : array 1 .. 6 of int
var rank : array 1 .. 49 of int
for i : 1 .. upper (rank)
    rank (i) := 0
end for

for i : 1 .. upper (num)
    num (i) := Rand.Int (1, 49)
    rank (num (i)) += 1
end for

for i : 1 .. 6
    put num (i)
end for

-----------------------------------
c0bra54
Thu Apr 28, 2005 8:57 pm


-----------------------------------
umm.. jut a question but, what exactly are you working on... is it like a lotto 6 49 generator or sumthing ???

-----------------------------------
Flikerator
Thu Apr 28, 2005 9:11 pm


-----------------------------------
umm.. jut a question but, what exactly are you working on... is it like a lotto 6 49 generator or sumthing ???

Yah. The 1..49 is to gather all the numbers and make a census of how many times each number was pressed. Practice for my tournament next month. Heres the question I just did for practise :)


var month, day : int
var months : array 1 .. 12 of string := init ("January", "February", "March", "April", "May", "June", "July", "Augest", "September", "October", "November", "December")
var monthn : array 1 .. 12 of int := init (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
var loc1, loc2 : int := 6

put "Enter month number (ei september = 9)"
get month
cls
put "Enter the number that day one falls on (Sunday = 1, Friday = 6 ext)"
get day
cls

locate (3, maxcol div 2 - (length (months (month)) div 2))
put months (month)
locate (4, 20)
put "SUN   MON   TUES   WED   THUR   FRI   SAT"
if day = 1 then
    loc2 := 21
end if
if day = 2 then
    loc2 := 27
end if
if day = 3 then
    loc2 := 34
end if
if day = 4 then
    loc2 := 40
end if
if day = 5 then
    loc2 := 46
end if
if day = 6 then
    loc2 := 53
end if
if day = 7 then
    loc2 := 59
end if

for i : 1 .. monthn (month)
    if i - 10 < 0 then
        locate (loc1, loc2)
    else
        locate (loc1, loc2 - 1)
    end if
    put i ..
    day += +1
    if day > 7 then
        day := 1
        loc1 += 2
    end if
    if day = 1 then
        loc2 := 21
    end if
    if day = 2 then
        loc2 := 27
    end if
    if day = 3 then
        loc2 := 34
    end if
    if day = 4 then
        loc2 := 40
    end if
    if day = 5 then
        loc2 := 46
    end if
    if day = 6 then
        loc2 := 53
    end if
    if day = 7 then
        loc2 := 59
    end if

end for


Main purpose of posting this is to view it at school, but feel free to test it out :)

-----------------------------------
Cervantes
Fri Apr 29, 2005 9:07 am


-----------------------------------
Perhaps you could store all the already picked values in a flexible array and then each time you pick a new random number, make sure that it is not equal to any values in the flexible array.

-----------------------------------
c0bra54
Fri Apr 29, 2005 10:50 pm


-----------------------------------
omg lol that calendor thing, we had to eb for a project :P was soo no fun lol.
