C Language Blog Job--function nested call

Source: Internet
Author: User

One, PTA Lab Assignment topic 1: Decimal conversion binary (1). PTA Submission List

(2). Design ideas
定义函数 dectobin  如果(n==1或n==0)     输出n 否则    递归 dectobin(n/2)  输出n%2    
(3). Code

(4). Problems encountered in debugging process and PTA Submission List situation description

The results of successive invocations of recursion are different, which is helpful for understanding the recursive principle

1.2 Student performance Management system 1.21 draw function module diagram, Brief introduction function function

1.2.2 Show your project documents

1.2.3 The function Code section to modify student information:

Sorting the total number of codes:


Delete Student Information:

1.2.4 Debug Results show


Can't run yet

Debugging encountered problems and solutions. Second, this week's topic set PTA Final Ranking

Third, read the code
猴子第一天摘下N个桃子,当时就吃了一半,还不过瘾,就又多吃了一个。第二天又将剩下的桃子吃掉一半,又多吃了一个。以后每天都吃前一天剩下的一半零一个。到第10天在想吃的时候就剩一个桃子了,问第一天共摘下来多少个桃子?并反向打印每天所剩桃子数。#include<stdio.h>#include<process.h>int main(){    /*打印最初的桃子数量*/    printf("%d\n", f(1));    system("pause");    return 0;}/*第day天剩下的桃子数*/int f(int day){    int n;    if(day==10)        n=1;    else    {        /*第day天(左)和第day+1天(右)所剩桃子的关系式*/        n=(f(day+1)+1)*2;        /*由于递归规律,直接倒序打印*/        printf("第%d天所剩桃子%d个\n", day, n);    }    return n;}    

Find out the law of the small monkeys to eat peach number, and will be recursive into this law to find the number of peach to eat each day, the remaining peaches in the day of the time the export of recursion

Iv. Study Summary of the Week 1. What did you learn?
    • Recursive functions
      That is, the function calls itself, and this invocation procedure is called recursion.
      Recursion can be equivalent to a loop, so to end the recursion, you have to terminate the recursive conditional test part, otherwise there will be infinite recursion (that is, infinite loop). At the same time, this is also the difficulty of using recursion.
      Advantages:
      1) Simple
      2) Suitable for solving factorial problems involving reverse order programming
      Disadvantages
      1) recursive fast memory consumption
      2) inconvenient to read and maintain
    • Macro definition
      Format:

      Define identifier string

      The identifier is called a symbolic constant, also known as a "macro name."
      Preprocessing (precompilation) work is also called macro expansion: Replace the macro name with a string.
      Cases:

      Define PI 3.1415926 Change the pi that appears in the program to 3.1415926
    • Second-level pointers
      Type name * * Variable name
      A (that is, the address of B) is a pointer to a pointer, called a level two pointer, a variable for holding a level two pointer is called a two-level pointer variable. According to the different cases of B, the level two pointer is divided into pointers to pointer variables and pointers to arrays.

2. Learning Experience
    • Two-dimensional pointers are upgraded versions of pointers, which are more difficult to understand and require special attention to pointer pointing problems
    • It's quite a challenge to build a project, but it's a step-by-step.
    • The back of the study on the book's Knowledge points need to be clearer, the recent problem-solving often read books, or read more reading

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.