# Classroom 3-trooped development (finding the maximum value of arrays of neutrons)

Source: Internet
Author: User

trooped Development: Lin Yanlu, Zhang

Title: Returns the and of the largest array in an integer array.

Requirements:

1, enter an array of integers, there are positive numbers in the array and negative numbers;

2. One or more integers connected in the array make up a sub-array, and each sub-array has a and;

3, the maximum value that is known as the number of sub-arrays.

This lesson is to learn trooped development, so first assigned the task: I mainly responsible for program analysis, code programming, Zhang responsible for code review, Code test plan.

Idea: My partner and I Zhang together to analyze the problem and unify the solution. First define 2 arrays (assuming there are n numbers), the relationship is as follows:

MAX[0] is the maximum value in {arr[0], arr[0]+arr[1] 、...、 arr[0]+arr[1]+...+arr[n-1]+arr[n]};

MAX[1] is the maximum value in {arr[1], arr[1]+arr[2] 、...、 arr[1]+arr[2]+...+arr[n-1]+arr[n]};

......

MAX[N-1] is the maximum value in {arr[n-1], arr[n-1]+arr[n]};

Max[n] is the maximum value in {Arr[n]} (that is, Max[n]=arr[n]).

Then compare the max array, and find the maximum value from it.

Source:

The array length is 5.

`1#include <iostream.h>2 3 intMain ()4 5 {6 7     intarr[5];8 9     inti,j;Ten  One     intmax[5]; A  -cout<<"input Array (five numbers):"<<Endl; -  the      for(i=0;i<5; i++) -  -     { -  +Cin>>Arr[i]; -  +     } A  at      for(i=0;i<5; i++) -  -     { -  -max[i]=Arr[i]; -  in     } -  to      for(j=0;j<4; j + +) +  -     { the  *          for(i=j+1;i<5; i++) \$ Panax Notoginseng         { -  thearr[j]=arr[j]+Arr[i]; +  A             if(max[j]<Arr[j]) the  +             { -  \$max[j]=Arr[j]; \$  -             } -  the         } - Wuyi     } the  -      for(i=0;i<5; i++) Wu  -     { About  \$         if(max[0]<Max[i]) -  -max[0]=Max[i]; -  A     } +  thecout<<"addmax="<<max[0]; -  \$     return 0; the  the}`

Operation Result:

Summary experience:

This trooped development carried out very smoothly, we completed the homework during recess, in the process of harvesting a lot. The first is in the discussion of ideas, need two people's general direction is consistent, although the procedure is relatively simple, but in large projects, there are many modules, this should be very important, and secondly in the implementation of functionality, although I am mainly responsible for code programming, but before tapping the keyboard we also discussed the actual solution, With what structure, how to nest ... A few minutes to find that everyone's ideas are still different, and everyone's mastery of the language, attention and focus on the details are different, communication can continue to improve programming skills, continue to open up; Finally, in the programming process, we are also relatively careless, two people can remind each other and supervise.

trooped development is necessary after the work, now not only to exercise their own programming skills, but also to focus on the ability to train team cooperation.

Classroom 3-trooped development (finding the maximum value of arrays of neutrons)

Related Keywords:

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.