Posts: 8
Threads: 2
Joined: Aug 2003
im new to qb. my assignment is to create a lottery program that picks 56 random non repeating numbers from 1 to 50 inclusive. the program should create a new sequence when the enter key is pressed and end the program when the <esc> key is pressed.
so far this is what i have
CLS
RANDOMIZE TIMER
rand = INT(RND *50) + 1
start:
PRINT rand(6)
DO
pressed$ = INKEY$
IF pressed$ = CHR$(13) THEN
CLS
GOTO start:
END IF
IF pressed$ = CHR$(27) THEN
CLS
END
END IF
LOOP
Posts: 1,080
Threads: 87
Joined: Feb 2002
Well what is your problem?
/post]
Posts: 394
Threads: 16
Joined: Jun 2003
Quote:im new to qb. my assignment is to create a lottery program that picks 56 random non repeating numbers from 1 to 50 inclusive.
Is that possible? I thought there were only 50 numbers from 1-50 inclusive! How can you pick the extra 6# and not have them repeat?
Here's what I think anyway:
YOINK!
Could use much improvement... did this quick.
ammit potato!
Posts: 1,688
Threads: 119
Joined: Jun 2003
don't give him code! i mean, he sez it's his assignment, so he obviously has to do it for school or something. the purpose of making a lottery game is to learn, so don't give it to him on a silver plate.
Jumping Jahoolipers!
Posts: 394
Threads: 16
Joined: Jun 2003
heh... took it off barok. good point, he almost suckered me into it. good thing he didn't come back on to see it
ammit potato!
Posts: 8
Threads: 2
Joined: Aug 2003
i'm not asking for code. like i said im new to this.
what i would like is some help. ya know like am I in the right direction, am i mising something,....something with a hint .....
pvera11<-----is really lost
Posts: 394
Threads: 16
Joined: Jun 2003
Quote:PRINT rand(6)
don't forget to dimension you array to accomodate all fifty-six integers you are attempting to generate. then, make sure to verify that none of the newly generated random numbers are equal to the previously stored ones.
that paragraph ought to make you think.
ammit potato!
Posts: 1,080
Threads: 87
Joined: Feb 2002
Quote:pvera11 Wrote:im new to qb. my assignment is to create a lottery program that picks 56 random non repeating numbers from 1 to 50 inclusive.
Is that possible? I thought there were only 50 numbers from 1-50 inclusive! How can you pick the extra 6# and not have them repeat?
Here's what I think anyway:
YOINK!
Could use much improvement... did this quick.
AFAIK you can get decimal values from RND ./?
/post]
Posts: 394
Threads: 16
Joined: Jun 2003
that's why he has INT(RND *50) + 1
ammit potato!
Posts: 1,956
Threads: 65
Joined: Jun 2003
Quote:pvera11 Wrote:im new to qb. my assignment is to create a lottery program that picks 56 random non repeating numbers from 1 to 50 inclusive.
Is that possible? I thought there were only 50 numbers from 1-50 inclusive! How can you pick the extra 6# and not have them repeat?
PVERA: What do you have to say about this? Sounds like the problem specs are faulty. You can't proceed without clearing this up. You asked for help, remember. We can't help if the specs don't make sense.
*****