Pair development--classroom practice--c++

Source: Internet
Author: User

Title and requirements Title: Returns the number of the largest subarray in an integer array.  Requirements: Into an array of shapes, there are positive numbers in the array and negative numbers.  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. Requires a time complexity of O (n).  Pair programming Requirements: The pair completes the programming task.  One person is mainly responsible for program analysis, code programming.  One person is responsible for code review and Code test plan. Publish a blog post about the process, experience, and how to resolve conflicts between two people (attach a work photo of the development). (As of Thursday March 19 24:00) Two, the pair development process

1. (in Class) we examining together, come up with algorithm implementation, and then we both on the paper to write the specific implementation of the code, each after the completion of each other, to explain each other, looking for imperfect place in the revision.

2. (class) found that the time complexity of the problem has not been resolved, the respective search information, change ideas, coding, mutual interpretation, to improve the sense of inadequacy of our two places.

Third, the source code

Wang Bingwu Donglongyan Date: 2015.3.17
#include <iostream.h>
#include <stdlib.h>
#include <time.h>
int main ()
{
cout<< "---------------------Small program----------------------" to find the maximum value of an array of neutrons <<endl;
cout<<endl;
int a[10];
int i;
Srand ((unsigned) time (NULL));//The random number seed is the current computer.
cout<< "The resulting set of random integers (10 numbers) is as follows:" <<endl;
for (i=0;i<10;i++)
{
A[i] = rand ()%21-10; Randomly generated-integers from 10 to 10
}
for (i=0;i<10;i++)
{
cout<<a[i]<< "";
}
cout<<endl;
int sum=0;
int greatesum=0;
for (i=0;i<10;i++)
{
Sum+=a[i];
if (sum<0)
{
sum=0;
}
if (sum>greatesum)
{
Greatesum=sum;
}
}
if (greatesum==0)
{
for (int i=0;i<10;i++)
{
if (greatesum==0)
{
Greatesum=a[i];
}
Else
if (Greatesum<a[i])
{
Greatesum=a[i];
}
}
}
cout<< "Max sum:" <<GreateSum<<endl;
System ("pause");
return 0;
}

Iv. Results of operation

V. Cooperation and experience

1. Two people cooperation sense of thought came quickly, the problem found in a timely manner, a lot of logical thinking errors. For example, a number of boundary values, I have to slowly test each time, with a partner, he directly said the boundary problem, a little complementary feeling, a lot of high efficiency.

2. At first I drove more, he pilot more points. Thinking has a problem, he driving a little more, I pilot a bit more.

Pair development--classroom practice--c++

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.