First, the experimental work 1.1 PTA topic design Thought
1.定义整形变量i,if(b==n-1)用于递归的终止,并返回1.2.for i=b to n ,if(a[i]<a[min]);进行升序排序3.sort(a,n)递归.
Code
Debugging issues
-
No
1.2 Student performance Management System 1.2.1 Drawing function module diagram, briefly introduces function function.
1.2.2 Show your project documents
1.2.3 Function Code Section
1.2.4 Debug Results show
-
Not done yet, follow-up additions.
1.2.5 debugging encountered problems and solutions. Second, this week's topic set PTA Final ranking.
Third, read the code
```
Include <bits/stdc++.h>
using namespace Std;
int n, TP, CNT;
int ans[14][14];
void Ans (int m);
int main ()
{
int T;
scanf ("%d", &t);
while (t--)
{
scanf ("%d", &n);
TP = 0, cnt = 0;
Ans (n);
for (int i = 0; i < n; i++)
{
for (int j = 0; J < N; j + +)
{
printf ("%d%c", ans[i][j], j = = n-1? ' \ n ': ' \ t ');
}
}
if (T! = 0)
printf ("\ n");
}
return 0;
}
void Ans (int m)
{
int I, J;
if (M <= 0)
Return
Else
{
i = TP;
for (j = tp; J < Tp+m; J + +)
ANS[I][J] = ++cnt;
j = tp+m-1; for(i = tp+1; i < tp+m; i++) ans[i][j] = ++cnt; i = tp+m-1; for(j = tp+m-2; j >= tp; j--) ans[i][j] = ++cnt; j = tp; for(i = tp+m-2; i > tp; i--) ans[i][j] = ++cnt; tp++; Ans(m-2);}
}
```
-
This set of problems is the problem of the spiral array of PTA arrays, but with the method of recursion through the critical conditions of the square from the far to the near layer of the history of the output of the spiral phalanx, not very understand, with the recursive method is really novel.
Iv. Summary of the study this Week 1. Introduce this week's learning content
- 1. Two-D pointer
- 2. Equivalence relationship of pointers in two-d arrays
- 3. Through the nesting of functions, the program file modules are connected together to form a large module.
- The 4.malloc () function dynamically allocates memory units of the corresponding size, handles multiple strings in a dynamically allocated memory method, avoids wasted memory, and finally frees up memory with free
-
5. Macro # #, you can define strings, etc., like functions.
2. Learning experience.
-
Academic pressure is very large, usually the content of the lecture is not fully understood. Especially this weekly hours malloc () function and macro, as well as the Student information management system, really confused.
In addition, the problem of the PTA array is very difficult, do not come out very difficult to suffer. The end of the end is coming, to review a lot of content, feel powerless. Hope to keep it good
Mentality, carefully review, to meet the upcoming final exam.
C function nesting