码迷,mamicode.com
首页 > 其他好文 > 详细

第三次作业

时间:2015-10-16 20:24:57      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

 

1         private void Form2_Load(object sender, EventArgs e)
2         {
3             textBox1.Text = Form1.Count.ToString();
4             textBox2.Text = Form1.fault.ToString();
5            // textBox3.Text = Form1.right.ToString();

技术分享


技术分享

  1    public partial class Form1 : Form
  2     {
  3         public static int Count = 0;
  4         private int t = 60;
  5         public static int right = 0;
  6         public static int fault = 0;
  7 
  8         public Form1()
  9         {
 10             InitializeComponent();
 11         }
 12 
 13         private void button4_Click(object sender, EventArgs e)
 14         {
 15             label2.Text = "/";
 16           // RandomNum();
 17         }
 18 
 19         private void button1_Click(object sender, EventArgs e)
 20         {
 21             label2.Text = "+";
 22            // RandomNum();
 23         }
 24 
 25         private void button2_Click(object sender, EventArgs e)
 26         {
 27             label2.Text = "-";
 28            // RandomNum();
 29         }
 30         private void button3_Click(object sender, EventArgs e)
 31         {
 32             label2.Text = "*";
 33            // RandomNum();
 34         }
 35         private void RandomNum()
 36         {
 37             Random ran = new Random();
 38             int n1, n2;
 39             n1 = ran.Next(1, 11);
 40             n2 = ran.Next(1, 11);
 41             textBox1.Text = n1.ToString();
 42             textBox2.Text = n2.ToString();
 43             textBox3.Text = "";
 44             Count++;
 45         }
 46         private void button6_Click(object sender, EventArgs e)
 47         {
 48 
 49             textBox3.Enabled = false;
 50             Form2 frm2 = new Form2();
 51             frm2.ShowDialog();
 52           
 53         }
 54         private void textBox3_KeyDown(object sender, KeyEventArgs e)
 55         {          
 56             int m;
 57             if (e.KeyCode == Keys.Enter)
 58             {
 59                 switch (label4.Text)
 60                 {
 61                     case "+":
 62                         m = int.Parse(textBox2.Text) + int.Parse(textBox3.Text);
 63                         break;
 64                     case "-":
 65                         m = int.Parse(textBox2.Text) - int.Parse(textBox3.Text);
 66                         break;
 67                     case "*":
 68                         m = int.Parse(textBox2.Text) * int.Parse(textBox3.Text);
 69                         break;
 70                     default:
 71                         m = int.Parse(textBox2.Text) / int.Parse(textBox3.Text);
 72                         break;
 73                 }
 74                 if (textBox3.Text == Convert.ToString(m))
 75                 {
 76                     right++;
 77                     RandomNum();
 78                 }
 79                 else
 80                 {
 81                     fault++;
 82                     RandomNum();
 83                 }
 84             }
 85         }
 86         private void button5_Click(object sender, EventArgs e)
 87         {
 88             label4.Text = t.ToString();
 89             timer1.Enabled = true;
 90             timer1.Interval = 1000;
 91             timer1.Start();
 92             RandomNum();
 93         }
 94         private void timer1_Tick(object sender, EventArgs e)
 95         {
 96             if (t <= 0)
 97             {
 98                 timer1.Enabled = false;
 99                 textBox3.Enabled = false;
100                 MessageBox.Show("时间到!!!");
101                 textBox3.Enabled = false;
102                 Form2 frm2 = new Form2();
103                 frm2.ShowDialog();
104             }
105             t = t - 1;
106             label4.Text = t.ToString();
107         }
108 
109         private void Form1_Load(object sender, EventArgs e)
110         {
111 
112         }
113     }
114 
115 }

 这次王斌同学的结队编程作业我知道了团队合作可以更好的完成项目,通过这次的结对编程让我上次没有做出来的正确个数做出来,可以让我们更好的进行交流,

这次的作业虽然只完成了一个倒计时但是结队编程能让我们更好的学习。今后会继续努力。

Personal Software Process Stages 耗时(分钟)
计划 10
估计用时 10
开发 270
需求分析 20
设计复审 20
代码规范 5
具体设计 50
具体编码 110
代码复审 10
测试 15
报告 25
测试报告 20
计算工作量 5
事后总结 30

 

第三次作业

标签:

原文地址:http://www.cnblogs.com/l964859839/p/4886195.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!