Qbasicnews.com

Full Version: i need some help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
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
Well what is your problem?
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.
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.
heh... took it off barok. good point, he almost suckered me into it. good thing he didn't come back on to see it Tongue
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
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.
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 ./?
that's why he has INT(RND *50) + 1
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.
*****
Pages: 1 2 3