猜数小游戏
2016-12-04 18:45
155 查看
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 WindowsFormsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void textBox1_TextChanged(object sender, EventArgs e) { } public int shu() { Random r = new Random(); int i= r.Next(1, 100); return i; } int b = 0; private void button1_Click(object sender, EventArgs e) { this.textBox2.Text = shu().ToString(); b = 0; //MessageBox.Show("a", "提--示", MessageBoxButtons.OK, MessageBoxIcon.Information); } private void Form1_Load(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { b++; if (this.textBox1.Text.Equals(this.textBox2.Text)) { MessageBox.Show("恭喜你猜对了", "提--示用了" + b + "遍", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (int.Parse(this.textBox1.Text) > int.Parse(this.textBox2.Text)) { MessageBox.Show("再小一点", "提--示用了" + b + "遍", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (int.Parse(this.textBox1.Text) < int.Parse(this.textBox2.Text)) { MessageBox.Show("再大一点", "提--示用了" + b + "遍", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
相关文章推荐
- 猜数小游戏
- python 猜数小游戏
- Python 猜数小游戏
- 一个自己编的小游戏——猜数
- 猜数小游戏
- 猜数小游戏、随机数产生
- 使用java File类编写的 猜数小游戏
- java servlet写的网页猜数小游戏
- 【年少的风】猜数小游戏
- 用JS实现简单的猜数小游戏
- Python入门-猜数小游戏演变
- android-猜数小游戏
- javascript实现的猜数小游戏完整实例代码
- 通过简单的循环语句,一个简单的猜数小游戏
- 【年少的风】猜数小游戏
- 【年少的风】猜数小游戏
- javascript实现的猜数小游戏完整实例代码
- C语言实现的一个简单的猜数小游戏
- javascript之猜数小游戏
- Python猜数小游戏