如果我想让程序生成一个随机数,我该怎么办re-read/loop
,else if statement
直到找到一个类似的语句 if (button1.Text == "")
,随机数只需要到 9。
这是我的代码,
private void button1_Click(object sender, EventArgs e)
{
var rc = new Random();
storeRI = rc.Next(1, 9);
if (storeRI == 1)
{
if (button1.Text == "")
{
button1.Text = "X";
}
else
{
//Need to generate another random number
//And read the else if statement again... how?
}
}
else if (storeRI == 2)
{
if (button1.Text == "")
{
button1.Text = "X";
}
else
{
//Need to generate another random number
//And read the else if statement again... how?
}
}