2015年10月16日 星期五

程式設計工藝大師
C# 拉霸





        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 c1 = 0,c2 = 0,c3 = 0, d1 = 0, d2 = 0, d3 = 0, radmoney1 = 100, radmoney2 = 100, radmoney3 = 100;
        public Form1()
        {
            InitializeComponent();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }
        private void button1_Click(object sender, EventArgs e)
        {
     
        }
        private void button2_Click(object sender, EventArgs e)
        {
         
        }
        private void button3_Click(object sender, EventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            c1 = 0;
            c2 = 0;
            c3 = 0;
            d1 = 1;
            d2 = 2;
            d3 = 0;
            timer1.Enabled = true;
            timer2.Enabled = true;
            timer3.Enabled = true;
            Random rnd = new Random();
            radmoney1 = rnd.Next(1, 101);
            radmoney2 = rnd.Next(1, 101);
            radmoney3 = rnd.Next(1, 101);
            button4.Text = radmoney1.ToString() + radmoney2.ToString() + radmoney3.ToString();



        }

        private void timer1_Tick(object sender, EventArgs e)
        {
       
            c1 = c1 + 1;
            d1 = c1 % 2;
         
            if (c1 >= radmoney1) timer1.Enabled = false;
         
         
            button1.Text = d1.ToString();
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            c2 = c2 + 1;
            d2 = c2 % 2;
            if (c2 >= radmoney2) timer2.Enabled = false;
            button2.Text = d2.ToString();
        }

        private void timer3_Tick(object sender, EventArgs e)
        {
            c3 = c3 + 1;
            d3 = c3 % 2;
            if (c3 >= radmoney3) timer3.Enabled = false;
            button3.Text = d3.ToString();

        }
        private void timer4_Tick(object sender, EventArgs e)
        {
            button4.Text = "start";

            if (d1 == d2 && d2 == d3)
            {
                button5.Text = "win";
            }
            else
            {
                button5.Text = "flaut";
               
            }

    }
}

沒有留言:

張貼留言