C Language Blog Job--function nested call

Source: Internet
Author: User

First, the Experiment Operation PTA Topic: 6-4 Decimal Conversion binary 1. PTA Submission List

2. Design Ideas
设置一个flag判断是否输入的数是单独为0的情况如果不是:且n不为0 ,每次n/2, 输出n%2
3. Code

4. Problems encountered during commissioning and solutions

Partially correct: does not take into account the case of the number of inputs 0
It's OK to discuss it separately.

Second, the Student Achievement 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

Header file

Main function

Increase student

Revise scores

Delete Student

Sort by number of studies

1.2.4 Debug Results show

The project still has some problems, the follow-up will continue to improve.

Third, this week's topic set PTA Final Ranking

Iv. Reading code

String strings Change
In the following program, the function fun function is to find the most ASCII value characters in the string str, move all characters before the character backward in the order of one position, and then put the character in the first position.

#include <stdio.h>   fun(char *p)    {       char max,*q; int i=0;       max=p[i];       while(p[i]!=‘\0‘)       {           if(max<=p[i])           {               max=p[i];               q=p+i;           }           i++;       }       while(q>p)       {           *q=*(q-1);           q--;       }       p[0]=max;    }    main()     {       char str[80];       printf("Enter a string: ");       gets(str);       printf("\nThe original string:   ");       puts(str);       fun(str);       printf("\nThe string after moving:  ");       puts(str);       printf("\n\n");    }  

This problem is a problem on the PTA, although I made it more complex, especially in the search for the ASCLL value of the largest letter reordering, the practice is complex and inefficient.
This code is done with just one loop. The letter that is recorded to the maximum value, from which the letter loop moves backward one position. The efficiency is high and the code is
Very concise.

V. Summary of the study this Week 1. Introduce this week's learning content
    • Macro definition
      A macro definition is also called a macro substitution, a macro substitution, or a macro.
      Format:
      "#define Identifier string"
      The identifier is called a symbolic constant, also known as a "macro name."
      such as # define Pi 3.1415926
      Change the pi that appears in the program to 3.1415926.
    • Pointer pointing to pointer
      Also known as Level two hands
      Such as:
      int a=10;
      int *p=&a;
      int **pp=&p;
2. Learning Experience
    • This week's homework is a little bit the same, is to build a project. Before it was fixed a topic to complete the corresponding function code is a page.
      Construction works into multiple pages, but also to string up to complete a number of functions. Just started to encounter a lot of difficulties, mainly linked to the problem. In fact, the code that satisfies the corresponding function is not particularly difficult to write. It's really time to spend a few more hours figuring it out.

C Language Blog Job--function nested call

Related Article

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.