程式設計工藝大師
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
int radmoney1 = 0, radmoney2 = 0, radmoney3 = 0; //radmoney4 = 0, radmoney5 = 0, radmoney6 = 0, radmoney7 = 0, radmoney8 = 0, radmoney9 = 0;
public Form1()
{
InitializeComponent();
button1.Enabled = false;
button2.Enabled = false;
button3.Enabled = false;
//button4.Enabled = false;
//button5.Enabled = false;
//button6.Enabled = false;
//button7.Enabled = false;
//button8.Enabled = false;
//button9.Enabled = false;
}
private void button10_Click(object sender, EventArgs e)
{
Random rnd = new Random();
radmoney1 = rnd.Next(0, 9);
radmoney2 = rnd.Next(0, 9);
radmoney3 = rnd.Next(0, 9);
//radmoney4 = rnd.Next(0, 9);
//radmoney5 = rnd.Next(0, 9);
//radmoney6 = rnd.Next(0, 9);
//radmoney7 = rnd.Next(0, 9);
//radmoney8 = rnd.Next(0, 9);
//radmoney9 = rnd.Next(0, 9);
button1.Text = radmoney1.ToString();
button2.Text = radmoney2.ToString();
if(radmoney1 == radmoney2||radmoney1 == radmoney3) { ; radmoney2 = rnd.Next(0, 9); button2.Text = radmoney2.ToString(); }//MessageBox.Show("the same")
button3.Text = radmoney3.ToString();
if (radmoney2 == radmoney3 || radmoney1 == radmoney3 || radmoney1 == radmoney2 ) { radmoney3 = rnd.Next(0, 9); button3.Text = radmoney3.ToString(); }//MessageBox.Show("the same");
//button4.Text = radmoney4.ToString();
//button5.Text = radmoney5.ToString();
//button6.Text = radmoney6.ToString();
//button7.Text = radmoney7.ToString();
//button8.Text = radmoney8.ToString();
//button9.Text = radmoney9.ToString();
button10.Enabled = true;
}
}
}
沒有留言:
張貼留言