I. Process of thought
Teachers in class let us cooperate to develop a small program, at first, the idea is more chaotic, but in the east with the snow after an idea gradually emerged, but there are still shortcomings in the loop control. Today is full of classes, so I would like to study in the evening to try to clarify their own ideas, and then to communicate with the snow East. Behold, I just arrived at the study room, he took a notebook to find me to discuss, and he has written his own ideas, but may be more clumsy, in the array number of changes need to go to the input program once, so our discussion from how to achieve the teacher's question to how better to achieve the teacher's problem, increase the scalability of the program.
In this cooperation we really like pilots and pilots, a computer, you say I speak a word of my own ideas, in the paper written on their own ideas, snow East is like the driver responsible for writing code, I write their ideas on paper, sometimes we exchange ideas, improve their ideas. Finally, we basically determine the function of the framework, in the process of writing code, or always discuss where to use which parameters, how to control conditions and so on. Here is our source code:
Second, the source code
//Ceshi.cpp:Defines the entry point for the console application.//#include"stdafx.h"#include"stdio.h"#include"stdlib.h"#include"time.h"intShuchu (intM[],intSZCDX,intXhy)//m[] represents the array to test, SZCHX represents the array length, Xhy represents the loop condition{ intt,p; intmax,sum; //Cache Array Assignment intc[ -]; intv[ -]; for(t=szcdx-xhy-1; t<szcdx;t++) {c[t-szcdx+xhy+1]=M[t]; } //Loops for(t=xhy;t>=0; t--) {sum=0; for(p=0;p <=t;p++) {sum=sum+C[p]; } V[t]=sum; } //cyclic output Maximum valuemax=v[0]; for(t=0; t<xhy+1; t++) { if(max<=V[t]) {Max=V[t]; } printf ("%d", v[t]); } returnMax;}intMainintargcChar*argv[]) { inta[5]={7,-3,5,-Ten,- A}; intmaxx[ -]; for(intI=4; i>=0; i--) {printf ("the and of all adjacent sub-arrays containing the number of%d in the array:",5-i); Maxx[i]=shuchu (A,5, i); printf ("\n%d\n\n", Maxx[i]); } intmaxxx=maxx[0]; for(i=0;i< -; i++) { if(maxxx<=Maxx[i]) {maxxx=Maxx[i]; }} printf ("\ n \ nthe maximum value of all the sub-arrays of the array:%d\n\n", maxxx); return 0;}
Third, the experimental test results
Array One: 7,-3,5,-10,-12
Second set of arrays: 100,3,-20,-10,-12
Iv. Harvest and experience after development of knot pair
This pair of development let me benefit, first of all two of us have the same purpose, although there are different ideas, but in the communication we are to a better way to solve the problem. Not like a person to feel so dull programming, they have the idea and others to share the feeling is also very happy, there is a person to accompany you think the problem to let you more serious to think about the problem, sometimes they think of the other side just thought, as we write the function of the implementation, when the parameters are used when we say there are errors, but , we will carefully look for the right one, which is not programmed by a person. In writing the function, the logic is really very mixed, I and snow are the same confused feeling, but we always in two people have agreed to enter the code, so it is a great honor to say that our function has not been changed successfully through the compilation. Communication is important, discussion is important, success is ahead.
Pair development is really a happy thing, especially when I and snow to see their hard-worked out the function of the successful realization of the time, we are very very happy, thank the teacher for giving us such a chance!
The following drawings:
A summary of the ideas of the development project in the Knot of classroom practice