16周总结

  1,需求分析---》拆成任务,编写代码
   这次作业是关于排球比赛计分程序,从排球比赛爱好着出发,希望每一个排球观众都能更好的了解比赛得分。
   作为一个排球爱好者,我希望知道排球比赛的得分,以便更好的掌握比赛得分。
   任务:a,作为排球爱好者需要知道每场两队的得分;
            b,需要知道两个队每局累加得分;
            c,两队比分哪一队胜出,怎么表示出来;
  2,生成设计文档
         加分界面 查分界面
  3,设计复审      两个小时
  4,代码规范     无
  5,具体设计  活动图

 


   6.代码编写
private void btnD2_Click(object sender, EventArgs e)
        {
           
            int D1 = Convert.ToInt32(txtD1.Text);
            int D2 = Convert.ToInt32(txtD2.Text);
            int DD1 = Convert.ToInt32(txtDD1.Text);
            int DD2 = Convert.ToInt32(txtDD2.Text);
            txtD2.Text = (b++).ToString();
            if (D2>= 24&&(D2-D1 )>1)
            {
                txtDD2.Text = (Convert.ToInt32(txtDD2.Text) + 1).ToString();
                txtD1.Text = "0";
                txtD2.Text = "0";
                txtCount.Text += "第" + (i++)+ "局:" + txtDD1.Text + ":" + txtDD2.Text + "\r\n";
                b= 1;
                if (txtDD2.Text=="3")
                {
                    MessageBox.Show("一队胜利");
                    txtD1.Text = "0";
                    txtDD1.Text = "0";
                    txtD2.Text = "0";
                    txtDD2.Text = "0";
                    txtCount.Clear();
                }
            }
            if(DD1+DD2>3)
            {
                if (D2 >= 14 && (D2 - D1) > 1)
                {
                    txtDD2.Text = (Convert.ToInt32(txtDD2.Text) + 1).ToString();
                    txtD1.Text = "0";
                    txtD2.Text = "0";
                    txtCount.Text += "第" + (i++) + "局:" + txtDD1.Text + ":" + txtDD2.Text + "\r\n";
                    b = 1;
                    if (txtDD2.Text == "3")
                    {
                        MessageBox.Show("二队胜利");
                        txtD1.Text = "0";
                        txtDD1.Text = "0";
                        txtD2.Text = "0";
                        txtDD2.Text = "0";
                        txtCount.Clear();
                        i = 1;
                    }
                }
            }
          
        }
 
  private void btnD1_Click(object sender, EventArgs e)
        {
            int D1 = Convert.ToInt32(txtD1.Text);
            int D2 = Convert.ToInt32(txtD2.Text);
            int DD1 = Convert.ToInt32(txtDD1.Text);
            int DD2 = Convert.ToInt32(txtDD2.Text);
            txtD1.Text = (a++).ToString();
            if (D1 >= 24 && (D1 - D2) > 1)
            {
                txtDD1.Text = (Convert.ToInt32(txtDD1.Text) + 1).ToString();
                txtD1.Text = "0";
                txtD2.Text = "0";
                txtCount.Text += "第" + (i++) + "局:" + txtDD1.Text + ":" + txtDD2.Text + "\r\n";
                a = 1;
                if (txtDD1.Text == "3")
                {
                    MessageBox.Show("一队胜利");
                    txtD1.Text = "0";
                    txtDD1.Text = "0";
                    txtD2.Text = "0";
                    txtDD2.Text = "0";
                    txtCount.Clear();
                }
            }
            if (DD1 + DD2 > 3)
            {
                if (D1 >= 14 && (D1 - D2) > 1)
                {
                    txtDD1.Text = (Convert.ToInt32(txtDD1.Text) + 1).ToString();
                    txtD1.Text = "0";
                    txtD2.Text = "0";
                    txtCount.Text += "第" + (i++) + "局:" + txtDD1.Text + ":" + txtDD2.Text + "\r\n";
                    a = 1;
                    if (txtDD1.Text == "3")
                    {
                        MessageBox.Show("二队胜利");
                        txtD1.Text = "0";
                        txtDD1.Text = "0";
                        txtD2.Text = "0";
                        txtDD2.Text = "0";
                        txtCount.Clear();
                        i = 1;
                    }
                }
            }
        }

 

posted on 2016-12-25 20:40  程序猿·  阅读(128)  评论(0编辑  收藏  举报

导航