public partial class Form1 : Form
{
public int k = 0; //接收随机数的值
int count = 0; // 计数
InitializeComponent();
}
/// <summary>
/// 新游戏按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
///
private void butNewGame_Click(object sender, EventArgs e)
{
this.txtNum.Enabled = true;
this.btnGuess.Enabled = true;
Random r = new Random();
k = r.Next(1, 100);//返回一个1~100的整数(包含1,但不包含100)
txtanswer.Text = Convert.ToString(k);//谜底Text框
{
public int k = 0; //接收随机数的值
int count = 0; // 计数
int number = 0; //输入猜的数值
public Form1()
{InitializeComponent();
}
/// <summary>
/// 新游戏按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
///
private void butNewGame_Click(object sender, EventArgs e)
{
this.txtNum.Enabled = true;
this.btnGuess.Enabled = true;
Random r = new Random();
k = r.Next(1, 100);//返回一个1~100的整数(包含1,但不包含100)
txtanswer.Text = Convert.ToString(k);//谜底Text框
}
public const