close
-------------------------------------------------------------
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
Random rnd = new Random();
int rndmoney1 = 0, rndmoney2 = 0, rndmoney3 = 0;
string a="Rock";
string b = "Paper";
string c="Scissors";
string d = "Draw";
string x = "Lose";
string f = "Win";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
rndmoney1 = rnd.Next(1, 4);
if (rndmoney1 == 1)
{
button4.Text = a;
button5.Text = d;
}
if (rndmoney1 == 2)
{
button4.Text = b;
button5.Text = x;
}
if (rndmoney1 == 3)
{
button4.Text = c;
button5.Text = f;
}
}
private void button2_Click(object sender, EventArgs e)
{
rndmoney2 = rnd.Next(1, 4);
if (rndmoney2 == 1)
{
button4.Text = a;
button5.Text = f;
}
if (rndmoney2 == 2)
{
button4.Text = b;
button5.Text = d;
}
if (rndmoney2 == 3)
{
button4.Text = c;
button5.Text = x;
}
}
private void button3_Click(object sender, EventArgs e)
{
rndmoney3 = rnd.Next(1, 4);
if (rndmoney3 == 1)
{
button4.Text = a;
button5.Text = x;
}
if (rndmoney3 == 2)
{
button4.Text = b;
button5.Text = f;
}
if (rndmoney3 == 3)
{
button4.Text = c;
button5.Text = d;
}
}
}
}
全站熱搜
留言列表