【文件属性】:
文件名称:彩排机选(我自己用C#编写的)
文件大小:4KB
文件格式:CS
更新时间:2015-11-13 05:30:03
彩排机选
可以机选福利彩票和体育彩票
public partial class 福利彩票 : Form
{
public 福利彩票(彩票机选 newFrom)
{
InitializeComponent();
MdiParent = newFrom;
}
static Random rd = new Random();
static List myshuzi = new List();//定义一个泛型集合类
static bool myBool;
static void ShuangSeQiuFangFa()
{
myBool = true;
while (myBool)
{
myBool = false;
myshuzi.Clear();
for (int i = 0; i < 6; i++)
{
myshuzi.Add(new shuzi(rd.Next(1, 34)));
}
for (int i = 0; i < 5; i++)
{
for (int j = i + 1; j < 6; j++)
{
if (myshuzi[j].x == myshuzi[i].x )
{
myBool = true;
}
}
}
}
Comparison sorter = new Comparison
(paixu.Compare);
myshuzi.Sort(sorter);
}
static void QiLeCaiFangFa()
{
myBool = true;
while (myBool)
{
myBool = false;
myshuzi.Clear();
for (int i = 0; i < 7; i++)
{
myshuzi.Add(new shuzi(rd.Next(1, 31)));
}
for (int i = 0; i < 6; i++)
{
for (int j = i + 1; j < 7; j++)
{
if (myshuzi[j].x == myshuzi[i].x)
{
myBool = true;
}
}
}
}
Comparison sorter = new Comparison
(paixu.Compare);
myshuzi.Sort(sorter);
}
private void button3D_Click(object sender, EventArgs e)
{
textBox1.Text = rd.Next(0, 10).ToString();
textBox2.Text = rd.Next(0, 10).ToString();
textBox3.Text = rd.Next(0, 10).ToString();
}
private void buttonshuangseqiu_Click(object sender, EventArgs e)
{
ShuangSeQiuFangFa();
textBox4.Text = myshuzi[0].x .ToString ();
textBox5.Text = myshuzi[1].x.ToString();
textBox6.Text = myshuzi[2].x.ToString();
textBox7.Text = myshuzi[3].x.ToString();
textBox8.Text = myshuzi[4].x.ToString();
textBox9.Text = myshuzi[5].x.ToString();
textBox10.Text = rd.Next(1, 17).ToString();
}
private void buttonqilecai_Click(object sender, EventArgs e)
{
QiLeCaiFangFa();
textBox17.Text = myshuzi[0].x.ToString();
textBox16.Text = myshuzi[1].x.ToString();
textBox15.Text = myshuzi[2].x.ToString();
textBox14.Text = myshuzi[3].x.ToString();
textBox13.Text = myshuzi[4].x.ToString();
textBox12.Text = myshuzi[5].x.ToString();
textBox11.Text = myshuzi[6].x.ToString();
textBox18.Text = rd.Next(1, 31).ToString();
}
}