Take it as a reference!
Private? int? num 1;
Private? int? num2
Private? int? num3
Private? int? Right? =? 0;
Private? int? Results;
Private? int? opr
Private? int? Count? =? 0;
Public? Invalid? Function ()
{
Random? Random? =? New? random();
num 1? =? Random. Next (10,? 100);
num2? =? Random. Next (10,? 100);
opr? =? Random. Next (0,? 2);
What if? (opr? ==? 0)? //+
{
The result? =? num 1? +? num2
label 1。 Words? =? num 1。 ToString()? +? "? +?" ? +? num2。 ToString()? +? "? =";
}
other
{
What if? (num 1? & lt? num2)
{
num3? =? num 1;
num 1? =? num2
num2? =? num3
}
The result? =? num 1? -? num2
label 1。 Words? =? num 1。 ToString()? +? "? -?" ? +? num2。 ToString()? +? "? =";
}
count++;
Text box 1. Words? =? ""; //Clear the answer text box
}
Private? Invalid? Form 1_Load (object? Sender? EventArgs? e)
{
Count? =? 0;
Right? =? 0;
func();
Label 2. Words? =? "***"? +? Count? +? What is the correct rate of the question? +? " 1";
}
Private? Invalid? textBox 1_KeyPress(object? Sender? KeyPressEventArgs? e)
{
String? Item;
Double? k;
What if? (e.KeyChar? ==? 13)
{
attempt
{
What if? (conversion. ToInt 16(textBox 1。 Text.ToString())? ==? Results)
{
Articles? =? label 1。 Words? +? Text box 1. Text.ToString()。 Trim()? +? "√";
//listBox 1。 Words? =? List box 1. Words? +? label 1。 text . ToString();
Right++;
}
other
{
Articles? =? label 1。 Words? +? Text box 1. Text.ToString()。 Trim()? +? "╳?" ? +? "? The correct answer is "? +? The result? ;
}
this.listBox 1。 Items.Add (project); //Add a theme to the list box
this.textBox 1。 Words? =? "";
k? =? ((Double), right? /? Calculate)? *? 100;
Label 2. Words? =? "***"? +? Count? +? What is the correct rate of the question? +? k.ToString()? +? "%";
func();
}
Catch? (exception? )
{
}
}
}