git用户名:wangpai1

学号后五位:03135

博客地址:https://www.cnblogs.com/wpghys/

作业链接:https://edu.cnblogs.com/campus/xnsy/SoftwareEngineeringClass2/homework/2795

一。vs2017上学期已装好,话不多说

 

 

  2.由于按流程下载git下不了,所以在360下载git

三  设计代码,代码如下,先随机产生三个数,然后对运算符分情况讨论,得到四则运算表达式,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
 
namespace Calculator
{

    public class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            for (int i = 0; i < n; i++)
            {
                Random r = new Random();
                int a = r.Next(0, 100);
                int b = r.Next(0, 100);
                int c = r.Next(0, 100);
                string[] e = { "+", "-", "*", "/" };
                char f, h;
                Random g = new Random();
                int ran = g.Next(0, 3);
                int re = g.Next(0, 3);
                f = char.Parse(e[ran % 4]);
                h = char.Parse(e[re % 4]);
                switch (f)
                {
                    case '+':
                        switch (h)
                        {
                            case '+':
                                Console.WriteLine(a + "+" + b + "+" + c + "=");
                                Console.ReadKey();
                                break;
                            case '-':
                                Console.WriteLine(a + "+" + b + "-" + c + "=");
                                Console.ReadKey();
                                break;
                            case '*':
                                Console.WriteLine(a + "+" + b + "*" + c + "=");
                                Console.ReadKey();
                                break;
                            case '/':
                                Console.WriteLine(a + "+" + b + "/" + c + "=");
                                Console.ReadKey();
                                break;
                        }
                        break;
                    case '-':
                        switch (h)
                        {
                            case '+':
                                Console.WriteLine(a + "-" + b + "+" + c + "=");
                                Console.ReadKey();
                                break;
                            case '-':
                                Console.WriteLine(a + "-" + b + "-" + c + "=");
                                Console.ReadKey();
                                break;
                            case '*':
                                Console.WriteLine(a + "-" + b + "*" + c + "=");
                                Console.ReadKey();
                                break;
                            case '/':
                                Console.WriteLine(a + "-" + b + "/" + c + "=");
                                Console.ReadKey();
                                break;
                        }
                        break;
                    case '*':
                        switch (h)
                        {
                            case '+':
                                Console.WriteLine(a + "*" + b + "+" + c + "=");
                                Console.ReadKey();
                                break;
                            case '-':
                                Console.WriteLine(a + "*" + b + "-" + c + "=");
                                Console.ReadKey();
                                break;
                            case '*':
                                Console.WriteLine(a + "*" + b + "*" + c + "=");
                                Console.ReadKey();
                                break;
                            case '/':
                                Console.WriteLine(a + "*" + b + "/" + c + "=");
                                Console.ReadKey();
                                break;
                        }
                        break;
                    case '/':
                        switch (h)
                        {
                            case '+':
                                Console.WriteLine(a + "/" + b + "+" + c + "=");
                                Console.ReadKey();
                                break;
                            case '-':
                                Console.WriteLine(a + "/" + b + "-" + c + "=");
                                Console.ReadKey();
                                break;
                            case '*':
                                Console.WriteLine(a + "/" + b + "*" + c + "=");
                                Console.ReadKey();
                                break;
                            case '/':
                                Console.WriteLine(a + "/" + b + "/" + c + "=");
                                Console.ReadKey();
                                break;
                        }
                        break;
                }
                       
    }
 }
 
 
        }
    }
 
 
四。进行单元测试
五 性能分析
六提交代码
 

 七 心得体会

第一次使用了github,虽然在这过程中遇到了很多问题,但是最后还是耐心的解决了,感觉蛮开心的,以前只知道写完代码之后,调试运行就可以了,然来还需要进行单元测试,回归测试,这些都可以保证我们代码的质量,这是我们作为一个程序员的基本素养;不仅如此,我们还可以进行效能分析,来进一步测试我们的代码,对我们的代码负责,还有就是我们可能会遇到各种困难,但也不要轻言放弃,总能找到解决办法的;

posted on 2019-03-25 21:06  王派  阅读(197)  评论(4编辑  收藏  举报