C Language Blog Job--function nested call

Source: Internet
Author: User

First, experimental work 1.1 PTA title: Recursive implementation of sequential output integer 1.1.1 design ideas
定义函数printdigits,形参为n接收数字判断n/10是否不等于0    如果是则递归调用函数printdigits(n/10)输出当前n的最后一位并换行
1.1.2 Code

1.1.3 Debugging problems

The topic is relatively simple, clear thinking, once over, and no debugging problems.

1.2 Student performance Management System second, this week's topic set PTA Final Ranking

Reading Code Monkeys eat Peach

The monkey picked a few peaches on the first day, ate half of it, and ate one more. The next morning to eat the rest of the peach half, or not a lot of fun
Ate one. After every day eat the rest of the last half and add one. By the 10th day there was just one left. Q. How many peaches did the monkeys pick on the first day?

We can first 10 days apart to see, the tenth day left one, and this one is "the other half of the rest of the day plus one", then the nineth days there is 2*(1+1)=4 a, at this time Nineth day and eighth day together to see, then 8th Day has 2*(3+1) A, by this recursion.

Iv. Summary of the study this week 1.1. Introduce this week's learning content
    • 1. Function Nesting call: You can use the main function to solve the whole problem, it calls to solve the small problem of the function, and these functions have further calls to solve the smaller problems of the function, so as to form a nested call of the function, the use of structured thinking, so that the code looks clearer, the structure is clear.
    • 2. Recursion: With the function of nested calls, you can make the function call itself, the recursive function has two key points, recursive exit and recursive formula, these two conditions are indispensable; recursive function essence is to simplify the problem to form the same relatively simple situation, you can solve some problems that are difficult to solve by other methods.
    • 3. The macro definition format is:#define 宏名 宏定义字符串
    • 4. The use of macros: (1) Symbolic constants, such as PI, array size definition, to increase the flexibility of the program, (2) Simple function function implementation, (3) for the program to bring some convenience, when the program needs to write some of the same content, you can abbreviate the content as a macro. Note: macros are simply replacements.
    • 5. #include < need to include the file name > this will be found from the system folder, #include "file name to include" This will be found in the current folder, can not find and then from the System folder.
    • 6. The compile Pre-processing command is not compiled.
    • 7. The array of pointers defines the format:类型名 *数组名[数组长度];
    • 8. Level two pointer: pointer to pointer, defined in the form:类型名**变量名;
    • 9. Command-line arguments: The form is: 命令名 参数1 参数2 ··· 参数n . You can run the program by entering the executable file name as a command in the DOS Environment Command window.
2. Learning Experience

After a quick semester of study, I learned a lot from this course, I remember before the start of the language, I began to contact C, after playing their first code Hello World, my heart is extremely excited, and later in the classroom after the study with the Daily Code practice, I understand the C language more and more deeply, the code is more and more large, from the initial few lines of code, to the current hundreds of lines of code, review the process of growth, I have a little sense of accomplishment. But as the study continues to deepen, I feel more and more difficult, such as this time the student performance management system, to improve its robustness, I feel a little bit, so I still need to continue to strive to achieve some good results.

C Language Blog Job-function nested call

Contact Us

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.