First, the PTA experimental work 1:6-2 to find the maximum number of groups and the second maximum number 1. PTA Submission List
2. Design Ideas
定义整形变量 i,max=a[0],temp,b,lmax=a[1];for i=0 to n-1;a[i]>max进行判断是否有更大的数max=a[i];b=i; a[0]=max将最大数放在数组的第0个for i=1 to n;lmax=a[i]进行判断是否有更大的数lmax=a[i];b=i;a[1]=lmax将次大值放在数组的第一个
3. Code
4. Problems encountered in debugging process and PTA Submission List situation description.
2. Design Ideas
```
Define shaping variables i=0,count=0,bj,j,flag=0,k=0; array bg[100]
The number of i=0 to t[i]!= ' + ' with the count++ statistic array character
For i=0 to s[i]!= ' + '
S[I]==T[0] Proceed to the next decision
For J=0 to Count-1
J=count indicates that the same character exists, flag equals 1 for marking
For J=BJ to s[j]!= ' + '
Using the new array bg[k++]=s[j] to represent
For i=0 to bg[i]!= ' + '
Swap characters with array S[i]=bg[i], return s;
Flag!=0, returns null
3. Code
4. Problems encountered in debugging process and PTA Submission List situation description.
2. Design Ideas
3. Code
4. Problems encountered in debugging process and PTA Submission List situation description. Second, this week's topic set PTA Final ranking.
Third, read the code
-
The code of the class seems clear, simple and easy to understand.
-
Jia Liang This inscription character string change is used in the array to move the direct ordering, simple and clear.
Iv. Summary of this week's study
1. Summarize what you learned this week.
- With # include
- You can use pointers to represent arrays, in function definitions char *b, where the contents below the function can refer to p[i] to represent the values of the array in the main function;
- The pointer p is an address that, when it represents an array, can represent the values of the represented array individually, p++.
- The pointer is initialized when the pointer is applied.
- Defines a pointer to another pointer, assigns a value to the pointer, and so on, as the address content changes
As long as the pointer to that address will change
-
In the data structure should pay attention to add; Otherwise, it will cause a compilation error.
2. List some of the wrong questions this week.
- Reference answer
int N
A[i]==x
j<n-1
n=n-1
-
My answer.
int m; not seen below i<N;
A[i]==x
j<N-2 did not consider the boundary problem
N=*n-1
- Reference answer
Sum=fun (s)
S
sum=sum+s ' 0 '
-
My answer.
Sum=fun (s)
S!=0
sum=sum+s does not convert it to a number
- Reference answer
Length (s)
*q
return n
-
My answer.
Length (s)
*q!=0
return 0; Returns the quantity.
C Language Pointers