Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Mark3D
21
Years of Service
User Offline
Joined: 29th Mar 2003
Location: United Kingdom
Posted: 31st Mar 2003 19:36
I only bought DarkBasic like 2 days ago and I came up with this program;

dim lotto$(49)

lotto$(1)="1"
lotto$(2)="2"
lotto$(3)="3"
lotto$(4)="4"
lotto$(5)="5"
lotto$(6)="6"
lotto$(7)="7"
lotto$(8)="8"
lotto$(9)="9"
lotto$(10)="10"

lotto$(11)="11"
lotto$(12)="12"
lotto$(13)="13"
lotto$(14)="14"
lotto$(15)="15"
lotto$(16)="16"
lotto$(17)="17"
lotto$(18)="18"
lotto$(19)="19"
lotto$(20)="20"

lotto$(21)="21"
lotto$(22)="22"
lotto$(23)="23"
lotto$(24)="24"
lotto$(25)="25"
lotto$(26)="26"
lotto$(27)="27"
lotto$(28)="28"
lotto$(29)="29"
lotto$(30)="30"

lotto$(31)="31"
lotto$(32)="32"
lotto$(33)="33"
lotto$(34)="34"
lotto$(35)="35"
lotto$(36)="36"
lotto$(37)="37"
lotto$(38)="38"
lotto$(39)="39"
lotto$(40)="40"

lotto$(41)="41"
lotto$(42)="42"
lotto$(43)="43"
lotto$(44)="44"
lotto$(45)="45"
lotto$(46)="46"
lotto$(47)="47"
lotto$(48)="48"
lotto$(49)="49"

print "Your 1st lottery number- ",lotto$(rnd(49))
print "Your 2nd lottery number- ",lotto$(rnd(49))
print "Your 3rd lottery number- ",lotto$(rnd(49))
print "Your 4th lottery number- ",lotto$(rnd(49))
print "Your 5th lottery number- ",lotto$(rnd(49))
print "Your 6th lottery number- ",lotto$(rnd(49))
print
print "PRESS ANY KEY TO EXIT."
suspend for key

NOW, my problem is, when i made an executable, i works fine until i reach the 4th number, it prints it but with no number and then the 5th number line overlaps it for some reason. Could any of you guys out there help me???
One more thing, how do i stop 1 number bieng pickeed twice, or all the numbers being the same??

THX for any help, Mark
Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 31st Mar 2003 20:37
rnd(49) picks a random number from 0 to 49, and the 4th number in your program comes out as zero. Change lotto$(rnd(49)) with lotto$(rnd(48)+1). To stop rnd picking the exact same sequence of numbers each time u gotta use randomize. Always put this at start of any program that uses rnd: RANDOMIZE TIMER()

But why you defining an array with same value as the index?

Try this:

spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 1st Apr 2003 01:16
Easier to go into shop and buy a 'lucky dip'

Gronda, Gronda
Mnemonix
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 1st Apr 2003 03:46
U shud get out of the habit of using string variables to represent numbers. This will spell only trouble since it is more difficult to do arithmetic on a number inside of a string. You can display a number variable on the screen by using the print command.

Im addicted to Proplus.
Current Project: Eternal Destiny by Halbros Productions
http://www.halbrosproductions.netfirms.com
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 1st Apr 2003 07:16
heres some small additions to your program to save the hassle of long winded declarations



Login to post a reply

Server time is: 2024-11-24 08:41:45
Your offset time is: 2024-11-24 08:41:45