Untitled
unknown
csharp
2 years ago
1.8 kB
3
Indexable
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp2 { public partial class Form2 : Form { public Form2() { InitializeComponent(); } int sayi; int skor; private void button1_Click(object sender, EventArgs e) { skor = 100; sayi = 5; //textBox5.Text = "Skor: " + skor.ToString(); // button2.Enabled = true; //Random rastgele = new Random(); //sayi = rastgele.Next(0,100); // textBox4.Text = " Welcome to the game..."; } private void button2_Click(object sender, EventArgs e) { int tahmin = Convert.ToInt32(textBox1.Text); if (tahmin < sayi) { textBox3.Text = "Yukarı"; skor = skor - 10; textBox2.Clear(); } else if (tahmin > sayi) { textBox2.Text = "Aşağı"; skor = skor - 10; textBox3.Clear(); } if(sayi == tahmin) { textBox1.Clear(); textBox2.Clear(); textBox5.Text = "TEBRİKLER...."; } if(skor == 0) { textBox5.Text = "GAME OVER !!! sayı " + sayi ; button2.Enabled = false; } textBox5.Text ="Skor: " + skor.ToString(); textBox1.Clear(); } } }
Editor is loading...