---restore content starts---
First, the experimental work student performance management System Requirements 1.1 PTA topic 6-5 Recursive implementation sequential output integer
Second, this week's topic set PTA Final Ranking
Third, read the code to a certain number of steps there are several ways
#include <stdio.h>#include <stdlib.h>#include <string.h>static int step[128];static int m = 1;int count(unsigned int n);void cout(int n,int t);int main(){int a; unsigned int n; while(1){printf("请输入需要登上的台阶数量:");scanf("%d",&n);a = count(n);printf("登上%d个台阶共有%d种方法!分别如下:\n",n,a);cout(n,0); m=1; }system("pause");return 0;}int count(unsigned int n){ if(n == 1) return 1 ; if(n == 2) return 2 ; else return count(n - 1) + count(n - 2) ;}void cout(int n,int t){ int i,j; if(n<0) return ;if(n == 0) {printf("第%d种方法:",m);for(j=0;j<t;j++) printf("%d ",step[j]);m++; printf("\n"); } else {for(i=1;i<=2;i++){step[t] = i;cout(n-i,t+1);} }}
The function outputs the sum of all the sums of a number and sorts the digits of the number, and sets the static global variables before recursion to realize the condition that the recursive time-varying quantity does not reset. Iv. Summary of this week's study
- learned about recursive functions and macros with parameters
- You can set the number of pointers to hold pointer variables and set function pointers so that pointers point to functions
- Defines a pointer to a pointer to a level two pointer
- You can use the malloc () function to set up dynamic memory to avoid wasted space, freeing memory with the free () function
Learning experience
- There is still some misunderstanding about the engineering documents, not very understanding.
C Language Blog Job--function nested call