排球积分

winform

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace YinTaiping
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int a = 1;
        int b = 1;
        int i = 1;

        private void btnC_Click(object sender, EventArgs e)
        {
            int C = Convert.ToInt32(txt1.Text);
            int M = Convert.ToInt32(txt2.Text);
            int c1 = Convert.ToInt32(txt3.Text);
            int m1 = Convert.ToInt32(txt4.Text);
            txt1.Text = (a++).ToString();
            if (C >= 24 && (C - M) > 1)
            {
                txt3.Text = (Convert.ToInt32(txt3.Text) + 1).ToString();
                txt1.Text = "0";
                txt2.Text = "0";
                a = 1;
                if (txt3.Text == "3")
                {
                    MessageBox.Show("巴西队胜利!!");
                    txt1.Text = "0";
                    txt3.Text = "0";
                    txt2.Text = "0";
                    txt4.Text = "0";
                }
            }
            if (c1 + m1 > 3)
            {
                if (C >= 14 && (C - M) > 1)
                {
                    txt3.Text = (Convert.ToInt32(txt3.Text) + 1).ToString();
                    txt1.Text = "0";
                    txt2.Text = "0";
                    a = 1;
                    if (txt3.Text == "3")
                    {
                        MessageBox.Show("巴西队胜利!!");
                        txt1.Text = "0";
                        txt3.Text = "0";
                        txt2.Text = "0";
                        txt4.Text = "0";
                        i = 1;
                    }
                }
            }
        }

        private void btnM_Click(object sender, EventArgs e)
        {
            int H = Convert.ToInt32(txt1.Text);
            int L = Convert.ToInt32(txt2.Text);
            int H1 = Convert.ToInt32(txt3.Text);
            int L1 = Convert.ToInt32(txt4.Text);
            txt2.Text = (b++).ToString();
            if (L >= 24 && (L- H) > 1)
            {
                txt4.Text = (Convert.ToInt32(txt4.Text) + 1).ToString();
                txt1.Text = "0";
                txt2.Text = "0";
                b = 1;
                if (txt4.Text == "3")
                {
                    MessageBox.Show("中国队胜利!!");
                    txt1.Text = "0";
                    txt3.Text = "0";
                    txt2.Text = "0";
                    txt4.Text = "0";
                }
            }
            if (H1 + L1 > 3)
            {
                if (L >= 14 && (L-H) > 1)
                {
                    txt4.Text = (Convert.ToInt32(txt4.Text) + 1).ToString();
                    txt1.Text = "0";
                    txt2.Text = "0";
                    b = 1;
                    if (txt4.Text == "3")
                    {
                        MessageBox.Show("中国队胜利!!");
                        txt1.Text = "0";
                        txt3.Text = "0";
                        txt2.Text = "0";
                        txt4.Text = "0";
                        i = 1;

                    }

                }
            }
        }

    }
}

原文地址:https://www.cnblogs.com/yintaiping/p/6212846.html