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的问题。在编程方面而言,两个人加起来的力量绝对远超两个单独的个体。互相查错,共同学习进步,取长补短。这也许是这次作业交给我们的最重要的东西了吧。自己单独的时候的确容易懒惰,但是需要完成一份共同作业的时候就没法偷懒了。哪怕是现学,也不好意思什么都不做去坐享其成。感谢这次作业让我收获良多。

  • 相关阅读:
    Vue 2.x windows环境下安装
    VSCODE官网下载缓慢或下载失败 解决办法
    angular cli 降级
    Win10 VS2019 设置 以管理员身份运行
    XSHELL 连接 阿里云ECS实例
    Chrome浏览器跨域设置
    DBeaver 执行 mysql 多条语句报错
    DBeaver 连接MySql 8.0 报错 Public Key Retrieval is not allowed
    DBeaver 连接MySql 8.0报错 Unable to load authentication plugin 'caching_sha2_password'
    Linux系统分区
  • 原文地址:https://www.cnblogs.com/l994/p/5362226.html
Copyright © 2011-2022 走看看