Lotto Program
Posted: Fri Apr 29, 2011 10:21 am
Hello, How can i improve this little program?
I need that the numbers don?t repeat themselves.
[code]
dim ran as integer, num1 as integer, num2 as integer, num3 as integer, num4 as integer
dim ran1 as integer, num5 as integer, num6 as integer
dim a as string, nums1 as string, nums2 as string, nums3 as string, nums4 as string
dim b as string, nums5 as string, nums6 as string
object img as bitmap
loadfromfile(DIR$("@")+"eur.bmp")
end object
Object form1 as form
width=400
height=250
onpaint=frmpaint
caption="EuroMilh?es"
object editbox as edit
left=30
top=20
width=50
end object
object editbox1 as edit
left=90
top=20
width=50
end object
object editbox2 as edit
left=150
top=20
width=50
end object
object editbox3 as edit
left=210
top=20
width=50
end object
object editbox4 as edit
left=280
top=20
width=50
end object
object editbox5 as edit
left=120
top=80
width=50
end object
object editbox6 as edit
left=190
top=80
width=50
end object
object btn as button
left=80
top=170
width=80
caption="Gerar N?meros"
onclick=numeros
end object
object btn1 as button
left=200
top=170
width=80
caption="Gerar Estrelas"
onclick=estrelas
end object
end object
form1.showmodal
sub numeros(s as button)
num1=RND(50)+1
nums1=str$(num1)
editbox.text=nums1
num2=RND(50)+1
nums2=str$(num2)
editbox1.text=nums2
num3=RND(50)+1
nums3=str$(num3)
editbox2.text=nums3
num4=RND(50)+1
nums4=str$(num4)
editbox2.text=nums4
num5=RND(50)+1
nums5=str$(num5)
editbox3.text=nums5
num6=RND(50)+1
nums6=str$(num6)
editbox4.text=nums6
END SUB
sub estrelas(s as button)
ran=RND(9)+1
a=str$(ran)
ran1=RND(9)+1
b=str$(ran1)
editbox5.text=a
editbox6.text=b
end sub
sub frmpaint(s as form)
s.canvas.draw(0,0,img)
end sub
[/code]
I need that the numbers don?t repeat themselves.
[code]
dim ran as integer, num1 as integer, num2 as integer, num3 as integer, num4 as integer
dim ran1 as integer, num5 as integer, num6 as integer
dim a as string, nums1 as string, nums2 as string, nums3 as string, nums4 as string
dim b as string, nums5 as string, nums6 as string
object img as bitmap
loadfromfile(DIR$("@")+"eur.bmp")
end object
Object form1 as form
width=400
height=250
onpaint=frmpaint
caption="EuroMilh?es"
object editbox as edit
left=30
top=20
width=50
end object
object editbox1 as edit
left=90
top=20
width=50
end object
object editbox2 as edit
left=150
top=20
width=50
end object
object editbox3 as edit
left=210
top=20
width=50
end object
object editbox4 as edit
left=280
top=20
width=50
end object
object editbox5 as edit
left=120
top=80
width=50
end object
object editbox6 as edit
left=190
top=80
width=50
end object
object btn as button
left=80
top=170
width=80
caption="Gerar N?meros"
onclick=numeros
end object
object btn1 as button
left=200
top=170
width=80
caption="Gerar Estrelas"
onclick=estrelas
end object
end object
form1.showmodal
sub numeros(s as button)
num1=RND(50)+1
nums1=str$(num1)
editbox.text=nums1
num2=RND(50)+1
nums2=str$(num2)
editbox1.text=nums2
num3=RND(50)+1
nums3=str$(num3)
editbox2.text=nums3
num4=RND(50)+1
nums4=str$(num4)
editbox2.text=nums4
num5=RND(50)+1
nums5=str$(num5)
editbox3.text=nums5
num6=RND(50)+1
nums6=str$(num6)
editbox4.text=nums6
END SUB
sub estrelas(s as button)
ran=RND(9)+1
a=str$(ran)
ran1=RND(9)+1
b=str$(ran1)
editbox5.text=a
editbox6.text=b
end sub
sub frmpaint(s as form)
s.canvas.draw(0,0,img)
end sub
[/code]