zoukankan      html  css  js  c++  java
  • 作业4

    #结对编程项目——四则运算
    对于四则运算项目基本的功能要求:
    这次,冯老师给我们的作业要求主要有以下几点:
    1.实现一个带有用户界面的四则运算
    2.对运算题目的数量做出限制
    3.对运算题目的数值范围做出限制
    4.对运算题目的有无乘除法做出限制(暂未完成)
    我们经过自己组内不断的钻研努力,终于基本完成了这个项目

    ##伙伴信息:

    计科13级1班 刘维淇 130201111

    计科13级1班 马亚坤 130201136

    ##题型设定
    ```
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;

    namespace WindowsFormsApplication2
    {

        public partial class Form2 : Form
        {
            int n, r1,r2,ysf;
            
            Form2 form2;
            public Form1()
            {
                InitializeComponent();
                
            }


            private void button1_Click(object sender, EventArgs e)
            {
                Random ran = new Random();
                n = Convert.ToInt32(comboBox1.Text.ToString());
                r1 = int.Parse(xiaxian.Text);
                r2 = int.Parse(shangxian.Text);
                if(comboBox2.SelectedItem.ToString() == "包含")
                {
                    ysf = 4;
                }
                else
                {
                    ysf = 2;
                }
                form2 = new Form3(n, r1, r2, ysf);
                form2.ShowDialog();
            }


            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                comboBox1.Text = comboBox1.SelectedItem.ToString();
               
            }

        }
    }
    ```




    ##出题界面
    ```
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;

    namespace WindowsFormsApplication2
    {
        public partial class Form3 : Form
        {
            char[] fuhao = { '+', '-', '*', '%' };
            int n, r1, r2, ysf;
          
      
            public Form2(int n, int r1, int r2, int ysf)
            {
                InitializeComponent();
                this.n = n;
                this.r1 = r1;
                this.r2 = r2;
                this.ysf = ysf;
                Form3 form3 = new Form3();
            }

            private void star_Click(object sender, EventArgs e)
            {
                listBox1.Items.Clear();
            }

            private void clear_Click(object sender, EventArgs e)
            {
                Application.Exit();
            }

            private void back_Click(object sender, EventArgs e)
            {
                string t = "";
                
                Random ran   = new Random();
                for (int i = 0; i < n; i++)
                {
                    int num1 = ran.Next(r1, r2);
                    int num2 = ran.Next(r1, r2);
                    if(ysf == 2)
                    {
                        t = num1 + fuhao[ran.Next(2)].ToString() + num2 + "=";
                    }
                    else
                    {
                        t = num1 + fuhao[ran.Next(4)].ToString() + num2 + "=";
                    }

                    listBox1.Items.Add(t);
                }
                
            }

            private void end_Click(object sender, EventArgs e)
            {
                this.Close();
            }

            
        }
    }
    ```



    ##程序运行截图:

    ##讨论图片:

    ##总结

    这次的题目对于我和马亚坤(同组成员)来说,实在是有些困难。总共两周的时间,我们两个人从找代码去模仿,读懂别人所完成的代码。到自己去制作这个软件,着实下了不少的功夫。但是幸好是结对学习,我俩能互相帮助,一同来完成这个题目。俗话说的好,三个臭皮匠顶个诸葛亮。人多了绝对不是1+1等于2的问题。在编程方面而言,两个人加起来的力量绝对远超两个单独的个体。互相查错,共同学习进步,取长补短。这也许是这次作业交给我们的最重要的东西了吧。自己单独的时候的确容易懒惰,但是需要完成一份共同作业的时候就没法偷懒了。哪怕是现学,也不好意思什么都不做去坐享其成。感谢这次作业让我收获良多。

  • 相关阅读:
    UVA 12901 Refraction 折射 (物理)
    UVA 12898
    UVA 690 PipelineScheduling 位运算+dfs+剪枝
    UVA1602 Lattice Animals 网格动物 (暴力,STL)
    UVA 810 A Dicey Promblem 筛子难题 (暴力BFS+状态处理)
    UVA 1600 Patrol Robert 巡逻机器人 (启发搜索BFS)
    UVA 536 TreeRocvery 树重建 (递归)
    二分查找
    OI记忆口诀
    OI经典语录
  • 原文地址:https://www.cnblogs.com/l994/p/5362226.html
Copyright © 2011-2022 走看看