using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace 猜数V2._
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int [] a=new int[5];//动态初始化数组
Random m = new Random();//初始化;
for (int i = 0; i < a.Length; i++)//循环(i为数组的下标)
{
num:
a[i] = m.Next(36) + 1;//产生一个(1到36)之间的数;
for (int j = 0; j < i;j++ )//循环j为数组的下标
{
if (a[i] == a[j])//如果i和j相同的话,就代表着两个数相同了
{
goto num;//那就淘汰此数,继续下一次的抽取数字;
}
}
foreach (int b in a)
{
textBox1.Text =a[i].ToString()+','+a[i+1];//这里怎么写?
}
textBox2.Text = DateTime.Now.ToString();
}
}
}
}