zoukankan      html  css  js  c++  java
  • 结伴编写程序

    //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

    哼!有了伙伴就是不一样!做的有兴趣了,也更想做了,俩人可以互相提出问题请求对方的 意见,在查找资料时也快了,果然团队是很重要的,

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

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

    相比着上次,我有了很大的进步,勇勇哥很有耐心地给我讲解每个步骤,十分感谢他。

  • 相关阅读:
    idea控制台乱码- tomcat-解决方案
    MySQL-事务面试题
    【实验4】函数和数组
    【实验3】C语言分支语句和循环语句编程应用
    【实验二】C语言表达式编程应用及输入输出函数
    【实验1】(任务四:测试你对非己因素的依赖程度)
    Python操作SQL
    SQL简单记录
    GUI编程 SMTP发送邮件实体化窗口
    Python GUI编程封装代码为exe应用窗口
  • 原文地址:https://www.cnblogs.com/yintaiping/p/4887926.html
Copyright © 2011-2022 走看看