Need help making a QBasic program

yellowperil

Diamond Member
Jan 17, 2000
4,598
0
0
I know, I know, it's QBasic. But that's the only programming language(?) I vaguely remember and I have to write a 8-page paper by tomorrow morning, so I can't bother to learn anything else. Plus it's the only programming software I have (on the WinME CD).

I'm trying to generate a random 10-digit number to be displayed for 3 seconds. I also need to generate a random 10-digit number in this format: XXX-XXX-XXXX, also for 3 seconds. I'm not sure where to begin other than RANDOMIZE TIMER. I'm using the help file to re-learn all the keywords but I'd appreciate any help on this. Thanks :)
 

esung

Golden Member
Oct 13, 1999
1,063
0
0
RANDOMIZE TIMER will start to seeding the Random Number Generator with the time variable.

the function you are looking for is RND() just use it like X=RND
and X will have a random value between 0 and 1. I think it's single precision, so it's probably have 5-7 places after decimal. in order
to generate a 10 digit number, you might need to do it 2-3 times, and add them to form a 10 digits number, say X=INT(RND*1000) will give you a value between 0 and 999.

hope this helps.. my QB is crummy as well.