<这段代码是要我们才一个随机数然后 ,出错了我找不到在哪?求帮忙>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace YouXi
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int count = 0;
int n = 0;
private void btnA_Click(object sender, EventArgs e)
{
Random r = new Random();
r.Next(0, 100);
this.btnB.Enabled = true;
count = 0;
int nn = 0;
try
{
nn = int.Parse(this.TextBox1.Text);
}
catch (Exception ex)
{
MessageBox.Show("请输入数字");
return;
}
count++;
if (nn=n )
{
MessageBox.Show("恭喜,用了{}次" + count);
}
else if (nn < n)
{
MessageBox.Show("小了");
}
else
{
MessageBox.Show("大了");
}
}
}
}