22 Aralık 2012 Cumartesi

sayısal loto

Public Class Form1

'Programımızda kullanacağımız değişkenleri tanımlıyoruz.
Dim Loto(0 To 5) As Integer
Dim min, max As Integer
Dim b As Integer
Dim Check As Boolean
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
' Oyun türünü belirliyoruz'
' Böylece programın 49 veya 54 sayıya kadar rastgele sayı seçmesini sağlayacağız.
TextBox1.Text = 0
TextBox2.Text = 0
TextBox3.Text = 0
TextBox4.Text = 0
TextBox5.Text = 0
TextBox6.Text = 0


If ComboBox1.Text = "Sayısal Loto (6/49)" Then
b = 49
End If

If ComboBox1.Text = "Süper Loto (6/54)" Then
b = 54
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button1.Click
'1 den 49'a veya 54'e kadar rastgele sayıları seçiyoruz.
str0:
Randomize()
Loto(0) = Int(Rnd() * b) + 1

If Loto(0) = 0 Then
GoTo str0
End If


str1:
Randomize()
Loto(1) = Int(Rnd() * b) + 1

If Loto(1) = Loto(0) Or Loto(1) = 0 Then
GoTo str1
End If

str2:
Randomize()
Loto(2) = Int(Rnd() * b) + 1

If Loto(2) = Loto(0) Or Loto(2) = Loto(1) Or Loto(2) = 0 Then
GoTo str2
End If

str3:
Randomize()
Loto(3) = Int(Rnd() * b) + 1

If Loto(3) = Loto(0) Or Loto(3) = Loto(1) Or Loto(3) = Loto(2) OrLoto(3) = 0 Then
GoTo str3
End If


str4:
Randomize()
Loto(4) = Int(Rnd() * b) + 1

If Loto(4) = Loto(0) Or Loto(4) = Loto(1) Or Loto(4) = Loto(2) OrLoto(4) = Loto(3) Or Loto(4) = 0 Then
GoTo str4
End If


str5:
Randomize()
Loto(5) = Int(Rnd() * b) + 1

If Loto(5) = Loto(0) Or Loto(5) = Loto(1) Or Loto(5) = Loto(2) OrLoto(5) = Loto(3) Or Loto(5) = Loto(4) Or Loto(5) = 0 Then
GoTo str5
End If
End Sub

Public Sub Swap(ByVal min As Integer)

For i = 0 To 4
min = i
For j = i + 1 To 5
If Loto(j) < Loto(min) Then min = j
Next j
' değiştirme işlemi burada belirtilecek 

Loto(i) = Loto(min)

Next i
End Sub

' Kaç tutturdum butonuna bastığımızda ,
' Çekilişi yapılan sayılardan kaçını ,
' Bildiğimizi hesaplatacağız.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles Button2.Click

'TUTTURDUĞUMUZ RAKAM SAYISI tutan İSİMLİ DEĞİŞKENDE SAKLANACAK.

Dim tutan As Integer
tutan = 0

'GİRİLen SAYILARIN ALTINDAKİ LABEL'LARDA ÇEKİLİŞTE ÇIKAN SAYILAR YAZACAK.
Label1.Text = Loto(0)
Label2.Text = Loto(1)
Label3.Text = Loto(2)
Label4.Text = Loto(3)
Label5.Text = Loto(4)
Label6.Text = Loto(5)

'AŞAĞIDAKİ KODLAR İLE ÇEKİLİŞTEKİ SAYILAR BİZİM SAYILARIMIZLA HER EŞİT OLDUĞUNDA tutan DEĞİŞKENİ BİR ARTACAK. SONUC İSE LABEL7'DE YAZACAK. 

If TextBox1.Text = Loto(0) Or TextBox2.Text = Loto(0) Or TextBox3.Text= Loto(0) Or TextBox4.Text = Loto(0) Or TextBox5.Text = Loto(0) OrTextBox6.Text = Loto(0) Then
tutan = tutan + 1
End If
If TextBox1.Text = Loto(1) Or TextBox2.Text = Loto(1) Or TextBox3.Text= Loto(1) Or TextBox4.Text = Loto(1) Or TextBox5.Text = Loto(1) OrTextBox6.Text = Loto(1) Then
tutan = tutan + 1
End If
If TextBox1.Text = Loto(2) Or TextBox2.Text = Loto(2) Or TextBox3.Text= Loto(2) Or TextBox4.Text = Loto(2) Or TextBox5.Text = Loto(2) OrTextBox6.Text = Loto(2) Then
tutan = tutan + 1
End If
If TextBox1.Text = Loto(3) Or TextBox2.Text = Loto(3) Or TextBox3.Text= Loto(3) Or TextBox4.Text = Loto(3) Or TextBox5.Text = Loto(3) OrTextBox6.Text = Loto(3) Then
tutan = tutan + 1
End If
If TextBox1.Text = Loto(4) Or TextBox2.Text = Loto(4) Or TextBox3.Text= Loto(4) Or TextBox4.Text = Loto(4) Or TextBox5.Text = Loto(4) OrTextBox6.Text = Loto(4) Then
tutan = tutan + 1
End If
If TextBox1.Text = Loto(5) Or TextBox2.Text = Loto(5) Or TextBox3.Text= Loto(5) Or TextBox4.Text = Loto(5) Or TextBox5.Text = Loto(5) OrTextBox6.Text = Loto(5) Then
tutan = tutan + 1
End If

Label7.Text = tutan & " sayi tutturdunuz"
End Sub


Private Sub ÇıkışToolStripMenuItem1_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) Handles ÇıkışToolStripMenuItem1.Click
Me.Close()
End Sub
Dim x As String

Private Sub HakkındaToolStripMenuItem2_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) Handles HakkındaToolStripMenuItem2.Click
x = " Sayısal/ Süper Loto v1.0.0 Designed by Mesut ÖZBAYRAK"
MsgBox(x)
End Sub
Dim y As String

Private Sub NasılOynanırToolStripMenuItem2_Click(ByVal sender AsSystem.Object, ByVal e As System.EventArgs) Handles NasılOynanırToolStripMenuItem2.Click
y = "Oyun türünü ilgili kısımdan seçerek alttaki kutulara tahmin ettiğiniz sayıları yazınız. Çekiliş Yap butonuna basarak programın çekiliş yapmasını sağlayınız. Kaç Tutturdum butonuna basarak kaç sayı bildiğinizi öğreniniz."
MsgBox(y)

End Sub


End Class

Hiç yorum yok:

Yorum Gönder