ana sayfa > C# > Sayısal Loto [C#]

Sayısal Loto [C#]

Cumartesi, 19 Ara 2009 yorum ekle yorumlara git

C#’ta sayısal loto yapımını birlikte inceleyelim…

Sayısal-Loto

 

 

 

 

 

 

 

 

 

 

  

 

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace WindowsApplication3

{

    public partial class Form1 : Form

    {

        int[] sayi = new int[6];

        int[] sayi1 = new int[6];

         public Form1()

        {

            InitializeComponent();

        }

       // ÇEKİLİŞ BUTONU

        private void button1_Click(object sender, EventArgs e)

        {

            int i, j, a, sayac = 1;

            textBox1.Text = “”;

            textBox2.Text = “”;

            Random rnd = new Random();

            for (i = 0; i <= 5; i++)

            {

                sayi[i] = rnd.Next(1, 49);

                textBox1.Text = textBox1.Text + ” ” + Convert.ToInt32(sayi[i]);

            }

            while (sayac == 1)

            {

sayac = 0;

                for (i = 0; i <= 4; i++)

                {

                    for (j = i + 1; j <= 5; j++)

                    {

                       // KARŞILAŞTIRMA VE SIRALAMA İŞLEMİ  

                        if (sayi[i] > sayi[j])

                        {  

                            a = sayi[i];

                            sayi[i] = sayi[j];

                            sayi[j] = a;

                        }

                        if (sayi[i] == sayi[j])

                        {

                            sayac = sayac + 1;

                            sayi[j] = rnd.Next(1, 49);

                            break;

                        }

                    }

                    if (sayac == 1)

                        break;

                }

            }

            for (i = 0; i <= 5; i++)

                textBox2.Text = textBox2.Text + ” ” + Convert.ToInt32(sayi[i]);

 }

//BAŞLA BUTONU

        private void button2_Click(object sender, EventArgs e)

        {

            int i, j, a, top, sayac, g;

            Random rnd = new Random();

            textBox4.Text = “0″ ;

            textBox5.Text = “0″ ;

            textBox6.Text = “0″ ;

            textBox7.Text = “0″ ;

            textBox8.Text = “0″ ;

            textBox9.Text = “0″ ;

            textBox10.Text = “0 “ ;

            listBox1.Items.Clear();

            listBox2.Items.Clear();

for (g=1; g<=Convert.ToInt32(textBox3.Text); g++)

            {

                for (i=0; i<=5; i++)

                {

                    sayi1[i]=rnd.Next(1,49);

                }

                sayac=1;

                while (sayac==1)

                {

                    sayac=0;

                    for (i=0; i<=4; i++)

                    {

                        for (j=i+1; j<=5; j++)

                        {

                            if(sayi1[i]>sayi1[j])

                            {

                                a=sayi1[i];

                                sayi1[i]=sayi1[j];

                                sayi1[j]=a;

                            }

                            if (sayi1[i]==sayi1[j])

                            {

                                sayac=sayac+1;

                                sayi1[j]=rnd.Next(1,49);

                                break;

                            }

                        }

                        if (sayac==1)

                            break;

                    }

                }

                listBox1.Items.Add(g+ “inci” + ” “ +Convert.ToInt32(sayi1[0])+ “ ” +Convert.ToInt32(sayi1[1])+ ” “ + Convert.ToInt32(sayi1[2])+ ” “ +Convert.ToInt32(sayi1[3])+ “ ” +Convert.ToInt32(sayi1[4])+ ” “ +Convert.ToInt32(sayi1[5]));

                top=0;

                for(i=0; i<=5; i++)

                    for(j=0; j<=5; j++)

                        if (sayi[i]==sayi1[j])

                            top=top+1;

if (top==0) 

textBox4.Text=Convert.ToString(Convert.ToInt32(textBox4.Text)+1);

 if (top==1)                   

textBox5.Text=Convert.ToString(Convert.ToInt32(textBox5.Text)+1);

if (top==2)                   

textBox6.Text=Convert.ToString(Convert.ToInt32(textBox6.Text)+1);

 if (top==3)                  

textBox7.Text=Convert.ToString(Convert.ToInt32(textBox7.Text)+1);

 if (top==4)                   

 textBox8.Text=Convert.ToString(Convert.ToInt32(textBox8.Text)+1);

 if (top==5)                   

textBox9.Text=Convert.ToString(Convert.ToInt32(textBox9.Text)+1);

 if (top==6)                  

 textBox10.Text=Convert.ToString(Convert.ToInt32(textBox10.Text)+1);

// ÜÇ BİLENDEN BAŞLADIK ÇÜNKÜ PARA ORDA :)

if (top==3)

listBox2.Items.Add(g+ “inci” + ” “ +sayi1[0]+ ” “ +sayi1[1]+ ” ” +sayi1[2]+ ” “ +sayi1[3]+ ” “ +sayi1[4]+ ” “ + sayi1[5]+ ” -Üç Bilen” );

 if (top==4)

listBox2.Items.Add(g+ “inci” + ” “ +sayi1[0]+ ” “ +sayi1[1]+ ” “ +sayi1[2]+ ” “ +sayi1[3]+ ” “ +sayi1[4]+ “ ” +sayi1[5]+” -Dört Bilen” );

 if (top==5)

listBox2.Items.Add(g+ “inci” + ” “ +sayi1[0]+ ” “ +sayi1[1]+ ” “ +sayi1[2]+ “ +sayi1[3]+ ” “ +sayi1[4]+ ” “ +sayi1[5]+ ” -Beş Bilen” );

 if (top==6)

listBox2.Items.Add(g+ “inci” + “ ” +sayi1[0]+ ” “ +sayi1[1]+ ” “ +sayi1[2]+ ” “ +sayi1[3]+ ” “ +sayi1[4]+ ” “ +sayi1[5]+” -Altı Bilen” );

            }

 }

       private void textBox4_TextChanged(object sender, EventArgs e)

        {

            textBox4.Refresh();

        }

         private void textBox5_TextChanged(object sender, EventArgs e)

        {

            textBox5.Refresh();

        }

         private void textBox6_TextChanged(object sender, EventArgs e)

        {

            textBox6.Refresh();

        }

         private void textBox7_TextChanged(object sender, EventArgs e)

        {

            textBox7.Refresh();

        }

        private void textBox8_TextChanged(object sender, EventArgs e)

        {

            textBox8.Refresh();

        }

         private void textBox9_TextChanged(object sender, EventArgs e)

        {

            textBox9.Refresh();

        }

         private void textBox10_TextChanged(object sender, EventArgs e)

        {

            textBox10.Refresh();

        }

       }

}




Related posts

coded by nessus
Share


Categories: C# Tags: ,
Bu kategorideki rastgele diğer yazılar
  • » C#'ta Hesap Makinesi
  • » Asansör Kontrol Programı [C#]
  • » C# İki sayı arasındaki sayıların toplamı
  • » C# 2-9 arası rakamlara bölünebilen sayılar(combobox)
  • » Foreach Döngüsü [C#]
  • » c#'ta Celcius Ve Fahrenayt
  • » Visual Studio Menüleri - File Menüsü [C#]
  • » Karakter Sayısı [C#]
  • » C#'ta işlemler
  • » C# ile Asal Sayılar
  • » C# If-Else & Switch-Case Yapısı
  • » C#'ta ListBox Ve ComboBox Kullanımı
  • » C# Varmısın Yokmusun Programı
  • » C#'ta Radio Button Kullanımı
  • » For Döngüsü [C#]



    1. Fatih Aydın
      Çarşamba, 23 Ara 2009 zamanında 11:45 | #1

      :)

    2. rifat
      Pazartesi, 04 Oca 2010 zamanında 18:46 | #2

      Arkadaş 3 gün sonra sınavım var. bir kaç soru soracaktım.
      1) 2 adet listbox var lst1, lst2 1 adet button var. lst1 de seçtiğimiz elemanlar (birden fazla secim olacak) abutona tıklandığında lst2 ye aktarılacak.

      2) yukarki sorumda olduğu gibi aynı elemanlar var bu sefer de butona basıldığında lst1 de olup lst2 de olmayanlar lst2 ye lst2 de olup lst1 de olmayanlar lst1 e aktarılacak.

      3) 1 combobox 1 listbox birde buton var. comboboxta secilen eleman listboxa aktarılacak

      4)comboboxta f5 e her basıldığında seçili eleman bir basamak yukarı ctrl+f5 e her basıldığında seçili eleman 1 basamak aşağı inecek.

      eğer yardımcı olursanız çok sevinirim

    3. ebru
      Salı, 16 Kas 2010 zamanında 04:08 | #3

      bana bunun algorıtması lazım akıs dıyagram seklıyle yha onu nereden bulabılırım acılen lazım :( acaba yardmcı olabılırmısınz?

    4. Cuma, 19 Kas 2010 zamanında 21:15 | #4

      ebru http://www.dahiweb.com/algoritma-ve-akis-diyagramlari-ornekleri-dongulu-akis-diyagramlari bu konuyu güzelce incele sonra yukarıdaki kodun algoritması ve akış diagramını çıkartmanın ne kadar kolay olduğunu anlayacaksın.

    1. şimdilik geri bağlantı yok

    *
    Bu bir spamlara karşı koruma yazılımıdır, resimde gösterilen güvenlik kelimesi girilmelidir. Kelimeyi sesli duymak için resmi tıklayın
    Anti-spam kelimeyi duymak için tıklayın