Installation of Visual Studio 2015 with the implementation of the largest sub-array and unit debugging

Source: Internet
Author: User

Last semester, due to unknown reasons, my personal notebook computer graphics driver was destroyed, personal ability and limited attempts to repair all failed, and accompanied by the failure of the graphics card driver caused various problems, and then the computer running slowly, based on the above reasons, in the last summer, just past I went to my city computer after the sale of my computer system updates and cleaning operations, this heavy installation system, I still choose the WIN10 system has been used for a period of time, but also because the system disk redo, resulting in the original download some software can not continue to use, so through the software engineering work opportunities, New installation of Visual Studio, a powerful programming software. I used the Visual Studio 2013 software, but learned that the Visual Studio software family had been updated to Visual Studio 2015, and by the early adopters, I copied the Visual Studio 2015 installation package from my classmates , below I will specifically describe my entire installation process with some considerations.

(Note: The film is selected from the network, because of unknown reasons, the individual did not save the success, please forgive me)

First, double-click the installation package application as an administrator and wait for the program to be automatically retrieved, and the following dialog box appears.

Here is the first point to note, after selecting the local installation address, the following will appear as shown in the tab, I first installed the first choice, if the first item is selected, only the most basic and basic visual Studio 2015, and even do not meet some of our needs as a beginner, So be sure to choose the second item, so that not only can choose some of the required features, but also in the future use from the "Tools" tab in the "Extensions and updates" in the "extension and update" to add some other features to facilitate future use.

First click on the agree terms of service and the Treaty box click Next, tick the function module we need, dialog box such as.

Since there are a lot of places I need to use C + + in the future, I have checked all the options in Visual C + + and its sub-options in the first tab programming language, and I have no control of the other, and I chose the next step.

Finally finalize the required options will be determined after being downloaded, I clicked on the download.

After that, as shown in the wait interface, about one hours or so, the dialog box prompts me to complete the installation.

After that, there is a big Blue Start button, click Start.

But during my actual installation, after the installation, there was an installation problem that prompted the Windows SDK Installer to fail with the hash value being incorrect.

Here are some of the solutions I've found online, but if you don't do anything, it doesn't affect your normal use.

Cause of the problem:

Estimated to be a network problem. There is a significant amount of network usage when installing the SDK and simulator with ISO.

Workaround:

1. Install the VS2015 Enterprise Edition without installing the VS2015 win10sdk and simulator (install vs2015 Choose a custom installation, remove the WIN10 SDK and the option to simulate installation. )

2, download Win10sdk's online installation sdksetup.exe execution program. Download and install.

3. Copy the contents of the C:\Program Files (x86) \ Windows Kits folder to (the folder of the Online SDK installation)

C:\Program Files (x86) \microsoft SDKs\Windows Kits\ (vs comes with folders)

4. Install the VS2015 Enterprise Edition again, and install the WIN10SDK and simulator selected by vs2015

5. Repair the installation vs2015 again


Of course this solution is based on the ability to download the standalone SDK (if the network conditions allow me to put the next good SDK and emulator to upload the network disk). In order to save time, I did not follow the above method to do, at least now can guarantee my normal use, so if in the future use of any problems to be solved by the above method is not too late. The following resolves the problem with the maximum number of sub-arrays mentioned in the job. The problem is as follows:

(1) The maximal subarray and algorithm are implemented, and the code is uploaded to the coding.net system;

(2) To choose the appropriate coverage criteria and design test cases to test the code, and publish the test results in a blog, the results are completed in tabular form.

Analyze the problem:

For the definition of the maximum subarray I refer to the blog of a Bo friend of Weibo, as follows:

One or more consecutive integers in an array make up a sub-array, each of which has a and. The maximum value for the and of all sub-arrays.

For example, the input array is {1,-2, 3, 10,-4, 7, 2,-5}, and the largest sub-array is {3, 10,-4, 7, 2}, so the output is the and 18 of that subarray.

It is easy to understand that when we add a positive number, it increases, and when we add a negative number, it is reduced. If the current sum is a negative number, then this and in the next summation should be discarded and re-zeroed, otherwise this negative will reduce the sum of the next. Based on this idea, we can write the following code.

Click http://www.cnblogs.com/chinaxmly/archive/2012/10/10/2718621.html to access his blog.

The code has been submitted to the Coding.net system, see link Https://git.coding.net/Mr_R/project-2.git

An explanation of the individual parts of the code

(1) #include<vector> for the first time

To put it bluntly, vector is a dynamic array, compared to the ordinary array, his advantage is that the use of space is high, before using the array size should not be set in advance, in the end of the array to insert the deletion of nodes faster than the general array, but in the middle of the array inserted delete is slower, so suitable for this job requirements.

(2) The Unit test function used for the first time

In fact, this feature is one of the many useful features of visual Studio 2015, but we have not contacted before, through the opportunity of this job, clear the use of unit testing, for the future use of the foreshadowing.

The first is to select the native Unit test project by selecting test options in the sub-project of the VC + + project in the Solution Explorer, right-click Add New Project on the solution. Such a unit test project, such as.

After the creation is complete, the empty project is.

Copy and paste personal code in

using namespace Microsoft::visualstudio::cppunittestframework;

Namespace UnitTest2

Between two pieces of code.

(3) for "TODO: Enter test code here" at the code fill

The function implemented here is that after the test program runs the result is the same as the actual calculation results, and then to determine whether the program is correct, so I filled out the following two code.

int actualvalue = Main ();
Assert::areequal (Actualvalue);

The first paragraph assigns the result of the main function to Actualvalue, the second segment compares the results of the manual calculation with the results of the program calculation, and gives the test results in the Test Explorer sidebar.

The final test results are presented in tabular form

Use Case number Use case description Input data Expected output data Actual output data Pass/No Pass Evaluation
1 Maximum sub-array is complete 1,2,3,4,5 15 15 Pass The result is correct, no problem
2 Maximum sub-array less than complete -1,-2,3,-4,5 5 5 Pass The result is correct, no problem
3 are all negative -1,-2,-3,-4,-5 -1 -1 Pass The result is correct, no problem
4 Empty set No Error 0 does not pass Did not consider extreme circumstances, had been corrected
5 A non-numeric representation of a letter 1,2,3,4,a Error Error Pass Program in this one the fault rate can also

The above for I software engineering the second homework all content, there must be insufficient or wrong place, please teacher, students criticize correct.

Installation of Visual Studio 2015 with the implementation of the largest sub-array and unit debugging

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.