The second individual assignments: familiar environment

GIT address https://github.com/cl12312
GIT Username cl12312
Student ID after five 24130
blog address https://www.cnblogs.com/chen100/
Job Link https://www.cnblogs.com/harry240/p/11515697.html

1. Environment configuration issues

Configuration a.VS environment

When freshman learning the C language vs2015 already installed, this time to re-install vs online download and install the package did not even lower to Blend Visual studio, later re-download the Visual studio2015 installation package. After a slow installation process, I wrote a "hello world!" Test environment, the results show execution error, then back online search solution, the installation process was originally used to clean up garbage Duba lead to loss of important documents can not run the C # program. Third reinstall after uninstalling Duba, finally C # program to run it properly.

b.Git and GitHub registration

github registration smoothly not met issue, download the GitHub relatively smooth.
在这里插入图片描述

2. cloning project

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

3. design ideas

a. New Project

在这里插入图片描述

b. Code ideas

// 编写出运算时并存入文本文件
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace cee
{
    class PrintCalcuate
    {
        public PrintCalcuate(int n)
        {
             char[] o = { '+', '-', '*', '/' };//四个运算符合放入数组中
            Random rd = new Random();
            int i = 0;
            while (i < n)
            {
                int h = rd.Next(2, 4);//随机生成的数字为了进行三个或者四个数字的随机运算
                int a = rd.Next(0, 100);
                string result = null;
                result = result + a;
                for (int j = 0; j < h; j++)
                {
                    int m = rd.Next(0, 4);
                    int b = rd.Next(0, 100);
                    if (o[m] == '/')
                    {
                        if (b != 0)
                        result = result + o[m] + b;
                        else
                            break;
                    }
                    else
                    result = result + o[m] + b;
                }
                if (Com(result) % 1 == 0 && Com(result) >= 0)//结果除以1有余数就说明是小数,为了不为负数必须保证结果大于等于0
                {
                    i++;
                    Console.WriteLine(result + "=" + Com(result));
                    CreatFile cf = new CreatFile(result );
                }
              }

        }
        public double Com(string result)//计算运算式的结果
        {

            DataTable da = new DataTable();
            double end = double.Parse(da.Compute(result, "").ToString());
            return end;
        }

    }
}
// 这是一个保存在D盘的subject文件所创建的类
namespace cee
{
    class CreatFile
    {
        public CreatFile(string st)
        {
            StreamWriter sw = new StreamWriter("D:/subject.txt", true);
            sw.WriteLine(st);
            sw.Close();

        }
    }
}
// 这是主函数
using System;
namespace cee
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入出题个数:");
            int n = Convert.ToInt32(Console.ReadLine());//输入要出题的个数并赋值给n
            PrintCalcuate calcuate1 = new PrintCalcuate(n);
            Console.ReadKey();

        }
    }
}

Operational results:
在这里插入图片描述results Notepad to open: the
在这里插入图片描述successful compilation of the results with notepad result has been, until ready to keep the C drive, but access is not enough to only put the D drive, stored in text files, and expression of the operation has been a problem after back online Search slowly after understanding written.

4. Test Project

a. Test Unit

在这里插入图片描述
在这里插入图片描述Because the unit test passes, the bug does not appear there is no further regression testing.

b. Set a breakpoint

在这里插入图片描述Breakpoints can quickly see what went wrong point in the program, but also a clear understanding of the operational program ideas.

c. potency test

(1) cpu test

在这里插入图片描述

(2) Gpu Usage

在这里插入图片描述

(3) memory usage

在这里插入图片描述

(4) Performance Analysis

在这里插入图片描述

(5) the tracking object allocation assignment在这里插入图片描述

5. Submit Code

代码提交一直没有成功,按照实验指导总是出错,后面试了网上的方法,按照这个网站https://blog.csdn.net/cai2016/article/details/51557682一步一步的来。然而错误还是出现,因为第一次使用git提交代码,所以复制地址本来需要http但是有些博客上说SSH所以一直出错,还有代码没有规范运行不了。按照我用的方法:首先创建一个文件夹(点进文件夹空白出在git bash 上输入git init),将代码复制带这个文件夹继续输入git add .(后面这个点是包括这个文件夹所有更改文件),查询状态发现文件名有绿色变成蓝色说明文件已经添加到临时仓库,在输入git commit -m“信息”
后输入查询状态再创建链接(记得输入htpps地址),然后pull文件到本地在push仓库临时文件到Achao服务器。
总的来说,最后一步上次代码比我预期还要困难,主要是不熟悉操作错误,花了很多时间在搜集信息上面,但还是值得。

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

6.心得体会

这次作业花费了两天的时间,开始按照实验指导还是很轻松到代码阶段自己一直想各种方法但是很难实现(C#的基础不行)。后面按照自己想的方法就去搜索各种博客看其他大佬的代码,看代码也是比较浪费时间的事情,花费不少时间看懂几份代码后自己慢慢写出代码不过运行通过结果却不对或者没有答案或者各种bug然后调试断点一步步改进最后写出一份。第一个份是用switch写的觉得代码重复而且范围有限,然后又用随机生成运算符、运算符个数和运算数字进行运算(这个是最开始想法但开始难以实现)。第二份比第一份代码写的快多了,不过还有不少问题出现,比如怎样运算代数、怎样存入文本文件不被覆盖.........
这次收获真的很大,对C#的很多语句又熟练很多除此之外也对C#其他之前没有学过的知识有了一定的掌握。Github也有了一定的认识,掌握了用git提交本地的代码,但是觉得自己耗费的时间太多了下次还是需要多学习再动手。

Guess you like

Origin www.cnblogs.com/chen100/p/11539618.html