这是一个不完整的代码,但我实在是找不出问题在哪里了。
求正解,,,,,
using System.Windows.Forms;
namespace 计算器 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public static int Count = 0; public static int right = 0; private void button4_Click(object sender, EventArgs e) { label2.Text = "/"; RandomNum(); } private void button1_Click(object sender, EventArgs e) { label2.Text = "+"; RandomNum(); } private void button2_Click(object sender, EventArgs e) { label2.Text = "-"; RandomNum(); } private void button3_Click(object sender, EventArgs e) { label2.Text = "*"; RandomNum(); } private void button5_Click(object sender, EventArgs e) { RandomNum(); } private void RandomNum() { Random ran = new Random(); int n1, n2; n1 = ran.Next(1, 11); n2 = ran.Next(1, 11); textBox1.Text = n1.ToString(); textBox2.Text = n2.ToString(); textBox3.Text = ""; Count++; } private void button6_Click(object sender, EventArgs e) { textBox3.Enabled = false; Form2 frm2 = new Form2(); frm2.ShowDialog(); } private void textBox3_KeyDown(object sender, KeyEventArgs e) { int m; { m = int.Parse(textBox1.Text) + int.Parse(textBox2.Text); m = int.Parse(textBox1.Text) - int.Parse(textBox2.Text); m = int.Parse(textBox1.Text) * int.Parse(textBox2.Text); m = int.Parse(textBox1.Text) / int.Parse(textBox2.Text); if (e.KeyCode == Keys.Enter) { if (textBox3.Text == m.ToString()) right++; RandomNum(); } } } } }