C# 10 numara oyunu

deli kurt1453

Katılımcı Üye
13 Ağu 2011
368
0
Korriban

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace onnumara
{
public partial class Form1 : Form
{
int[] a = new int[11];

private System.Windows.Forms.Button button1;
//2 buton (başlatma ve durdırma işlemi için)

private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.TextBox textBox8;
private System.Windows.Forms.TextBox textBox9;
private System.Windows.Forms.TextBox textBox10;
//80 numarada seçilen rasgele 10 numarayı yazdırmak
//için 10 tane textbox

private System.Windows.Forms.ListBox listBox1;
//her durdur butonuna basıldığında seçilen yeni
//10 luyu bu lixboxa eklemek için


public Form1()
{
InitializeComponent();
}


private **** button1_Click(object sender, EventArgs e)
{

Random r = new Random();

//Rastgele 1 ile 80 arasında 10 tane rakam belirler
for (int i = 0; i < 10; i++)
{
a = r.Next(1, 80);
for (int j = 0; j < i; j++)
if (a[j] == a)
i--;

Application.DoEvents();
}

//belirlenen 10 rakamı sıralar
for (int j = 0; j < 10; j++)
{
for (int i = 0; i < 10; i++)
{
if (a[j] < a)
{
a[10] = a[j];
a[j] = a;
a = a[10];
}
}
}

//belirlene 10 rakamı textboxlara yazdır.
textBox1.Text = a[0].ToString();
textBox2.Text = a[1].ToString();
textBox3.Text = a[2].ToString();
textBox4.Text = a[3].ToString();
textBox5.Text = a[4].ToString();
textBox6.Text = a[5].ToString();
textBox7.Text = a[6].ToString();
textBox8.Text = a[7].ToString();
textBox9.Text = a[8].ToString();
textBox10.Text = a[9].ToString();


//belirlenen 10 luyu listeleme işlemini yapar
//her butona basıldığında yeni 10 luyu listebox a atar
string liste = a[0].ToString();
for (int i = 1; i < 10; i++)
{
liste += " - " + a.ToString();
}

listBox1.Items.Add(liste);

}

private **** Form1_Load(object sender, EventArgs e)
{
//formun başlığı
this.Text = "ON NUMARA OYUNU";
}

#region Windows Form Designer generated code

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private **** InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.textBox7 = new System.Windows.Forms.TextBox();
this.textBox8 = new System.Windows.Forms.TextBox();
this.textBox9 = new System.Windows.Forms.TextBox();
this.textBox10 = new System.Windows.Forms.TextBox();
this.listBox1 = new System.Windows.Forms.ListBox();
this.SuspendLayout();
//
// button1
//
this.button1.******** = new System.Drawing.Point(56, 51);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(334, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Yeni 10 Numara Seç";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.******** = new System.Drawing.Point(56, 25);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(28, 20);
this.textBox1.TabIndex = 1;
//
// textBox2
//
this.textBox2.******** = new System.Drawing.Point(90, 25);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(28, 20);
this.textBox2.TabIndex = 2;
//
// textBox3
//
this.textBox3.******** = new System.Drawing.Point(124, 25);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(28, 20);
this.textBox3.TabIndex = 3;
//
// textBox4
//
this.textBox4.******** = new System.Drawing.Point(158, 25);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(28, 20);
this.textBox4.TabIndex = 4;
//
// textBox5
//
this.textBox5.******** = new System.Drawing.Point(192, 25);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(28, 20);
this.textBox5.TabIndex = 5;
//
// textBox6
//
this.textBox6.******** = new System.Drawing.Point(226, 25);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(28, 20);
this.textBox6.TabIndex = 6;
//
// textBox7
//
this.textBox7.******** = new System.Drawing.Point(260, 25);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(28, 20);
this.textBox7.TabIndex = 7;
//
// textBox8
//
this.textBox8.******** = new System.Drawing.Point(294, 25);
this.textBox8.Name = "textBox8";
this.textBox8.Size = new System.Drawing.Size(28, 20);
this.textBox8.TabIndex = 8;
//
// textBox9
//
this.textBox9.******** = new System.Drawing.Point(328, 25);
this.textBox9.Name = "textBox9";
this.textBox9.Size = new System.Drawing.Size(28, 20);
this.textBox9.TabIndex = 9;
//
// textBox10
//
this.textBox10.******** = new System.Drawing.Point(362, 25);
this.textBox10.Name = "textBox10";
this.textBox10.Size = new System.Drawing.Size(28, 20);
this.textBox10.TabIndex = 10;
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.******** = new System.Drawing.Point(56, 97);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(336, 121);
this.listBox1.TabIndex = 12;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(449, 265);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.textBox10);
this.Controls.Add(this.textBox9);
this.Controls.Add(this.textBox8);
this.Controls.Add(this.textBox7);
this.Controls.Add(this.textBox6);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion
}
}
 
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.