您的位置:首页 > 其它

结伴编写程序

2015-10-17 18:05 489 查看
//Form1的代码

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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public static int count = 0;
private int t = 60;
public static int right = 0;
public int result;
private void button5_Click(object sender, EventArgs e)
{
label2.Text=t.ToString();
timer1.Enabled = true;
timer1.Interval = 1000;
timer1.Start();
Random();

}
private void Random()
{
Random ab = new Random();

int a, b;
a = ab.Next(1, 11);
b = ab.Next(1, 11);
textBox1.Text = a.ToString();
textBox2.Text = b.ToString();
textBox3.Text = "";
count++;

}
private void timer1_Tick(object sender, EventArgs e)
{
if (t <= 0)
{
timer1.Enabled = false;
textBox3.Enabled = false;
MessageBox.Show("时间到!");
textBox3.Enabled = false;
}
t = t - 1;
label2.Text = t.ToString();

}

private void button1_Click(object sender, EventArgs e)
{
label3.Text = "+";
}

private void button2_Click(object sender, EventArgs e)
{
label3.Text = "-";
}

private void button3_Click(object sender, EventArgs e)
{
label3.Text ="*";
}

private void button4_Click(object sender, EventArgs e)
{
label3.Text = "/";
}

private void textBox3_KeyDown(object sender, KeyEventArgs e)
{

if (e.KeyCode == Keys.Enter)
{
switch (label3.Text)
{
case "+":
result = int.Parse(textBox1.Text) + int.Parse(textBox2.Text);
break;
case "-":
result = int.Parse(textBox1.Text) - int.Parse(textBox2.Text);
break;
case "*":
result = int.Parse(textBox1.Text) * int.Parse(textBox2.Text);
break;
case "/":
result = int.Parse(textBox1.Text) / int.Parse(textBox2.Text);
break;
}

if (textBox3.Text == result.ToString())
{

right++;
}
Random();

}
}

private void button6_Click(object sender, EventArgs e)
{
textBox3.Enabled = false;
Form2 frm2 = new Form2();
frm2.ShowDialog();
}

private void Form1_Load(object sender, EventArgs e)
{

}

}
}

//Form2的代码

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 WindowsFormsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

private void Form2_Load(object sender, EventArgs e)
{
textBox1.Text = Form1.count.ToString();
textBox2.Text = Form1.right.ToString();
textBox3.Text=((Form1.right/(double)(Form1.count))*100).ToString();
}
}
}









psp

计划10m
估计这个任务需要多长时间3h
开发40m
需求分析10m
生成设计文档10m
和同事复审设计6m
代码制定规范6m
具体设计20m
具体编码2h
代码复审30m
测试5m
报告5m
测试报告10m
计算工作量10m
事后总结5m
哼!有了伙伴就是不一样!做的有兴趣了,也更想做了,俩人可以互相提出问题请求对方的 意见,在查找资料时也快了,果然团队是很重要的,

勇勇哥很厉害,懂得很多,我就好像个打杂的伙计,忙着翻例题,搜索资料,也少了做不出来时的烦躁心情,过程中也是快快乐乐,又说有笑,

但是过程中还是有难点,还是比较吃力的,但是在两个人的努力之下慢慢地攻克了。

相比着上次,我有了很大的进步,勇勇哥很有耐心地给我讲解每个步骤,十分感谢他。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: