第二次作业

GIT地址 https://github.com/jain2199
GIT用户名 jain2199
学号后五位 24217
博客地址 https://home.cnblogs.com/u/yuanzhijie/
作业链接 https://www.cnblogs.com/harry240/p/11515697.html

熟悉使用工具

Part1.配置环境

之前用的版本有些低,特意下了一个新的编辑器

Part2.克隆项目

1.注册hithub账号

2.拷贝项目地址

3.新建文件夹中打开GIT BUSH

Part3.设计随机数四则运算项目

1.配置调试环境

2.用switch循环随机生成题目

sing System;
using System.IO;
using System.Collections.Generic;
using System.Text;

namespace AchaoCalculate
{
class PrintCalcuate
{

    public PrintCalcuate(int n)
    {
        
        int i = 0;
        int a, b, c, d, e, f;
        string st;
        Random rd = new Random();
        while (i < n)
        { 
            a = rd.Next(0, 100);
            b = rd.Next(0, 100);
            c = rd.Next(0, 100);
            d = rd.Next(0, 100);
            e = rd.Next(0, 100);
            f = rd.Next(1, 100);
            int m =rd.Next(0,9);
            switch (m)
            {
                
                case 0:
                    int end1 = b * c - a;
                    st = b + "*" + c + "-" + a + "=" + end1;
                    if (end1 >= 0)
                    {
                        Console.WriteLine(st);
                        CreatFile sw = new CreatFile(st);
                        i++;
                    }
                    break;
                case 1:
                    int end2 = e - c + b;
                    st = e + "-" + c + "+" + b + "=" + end2;
                    if (end2 >= 0)
                    {
                        Console.WriteLine(st);
                        CreatFile sw = new CreatFile(st);
                        i++;
                    }
                    break;
                case 2:
                    int end3 = e + f * d + c;
                    st = e + "-" + f + "*" + d + "+" + c + "=" + end3;
                    if (end3 >= 0)
                    {
                        Console.WriteLine(st);
                        CreatFile sw = new CreatFile(st);
                        i++;
                    }
                    break;
                case 3:
                    int end4 = b / f + e;
                    st = b + "/" + f + "+" + e + "=" + end4;
                    if (b % f == 0 && end4 >= 0)
                    {
                        Console.WriteLine(st);
                        CreatFile sw = new CreatFile(st);
                        i++;
                    }
                    break;
                case 4:
                    int end5 = c / f + c * d;
                    st = c + "/" + f + "+" + c + "*" + d + "=" + end5;
                    if (c % f == 0 && end5 >= 0)
                    {
                        Console.WriteLine(st);
                        CreatFile sw = new CreatFile(st);
                        i++;
                    }
                    break;
                case 5:
                    int end6 = e - c / f;
                    st = e + "-" + c + "/" + f + "=" + end6;
                    if (c % f == 0 && end6 >= 0)
                    {
                        Console.WriteLine(st);
                        CreatFile sw = new CreatFile(st);
                        i++;
                    }
                    break;
                case 6:
                    int end7 = e * f - c;
                    st = e + "*" + f + "-" + c + "=" + end7;
                    if (end7 >= 0)
                    {
                        Console.WriteLine(st);
                        CreatFile sw = new CreatFile(st);
                        i++;
                    }
                    break;
                case 7:
                    int end8 = e * f - c + a;
                    st = e + "*" + f + "-" + c + "+" + a + "=" + end8;
                    if (end8 >= 0)
                    {
                        Console.WriteLine(st);
                        CreatFile sw = new CreatFile(st);
                        i++;
                    }
                    break;
                case 8:
                    int end9 = e + c / f - a;
                    st = e + "+" + c + "/" + f + "-" + a + "=" + end9;
                    if (c % f == 0 && end9 >= 0)
                    {
                        Console.WriteLine(st);
                        CreatFile sw = new CreatFile(st);
                        i++;
                    }
                    break;
                case 9:
                    int end10 = c - a / f + a;
                    st = c + "-" + a + "/" + f + "+" + a + "=" + end10;
                    if (a % f == 0 && end10>= 0)
                    {
                        Console.WriteLine(st);
                        CreatFile sw = new CreatFile(st);
                        i++;
                    }
                    break;

                default:
                    break;


                    
            }
            
            
        }



    }


}

}

3.运行代码,成成题目

Part4.单元测试

1.测试通过 ,就没有进行回归测试

Part5.效能分析

Part6.提交代码

运用Git和Markdown,还很不熟悉,操作时出现了很多问题,包括VS运行时,已经有了代码却仍然好几次运行不了。

posted @ 2019-09-20 17:23  袁志杰  阅读(368)  评论(0编辑  收藏  举报