C Language Fifth Blog job---function

Source: Internet
Author: User

One, PTA Laboratory work Topic 1: Use the function to determine the total square number (1). PTA Submission List

(2). Design ideas

1. First step: Define two floating-point variable number,r;
2. The second step: the opening square of n is given number;
3. Step three: R=n/number;
4. Fourth step: If R=number, return 1; return 0;
5. Fifth Step: If n is 0, return 1;

(3). Problems encountered during commissioning and solutions

Problem:
The code doesn't pass when n=0 this test point.

Workaround: Write 0 as a special case, when n is 0 o'clock return 1;

Topic 2: Use the function to output an inverse number of integers (1). PTA Submission List

(2). Design ideas

1. First step: Define two integer variable r,a;
2. Step Two: If number is not equal to 0, enter the third step, otherwise enter the sixth step;
3. Step three: r=number%10;
4. Fourth step: a=a*10+r;
5. Fifth step: NUMBER=NUMBER/10; return to the second step;
6. Sixth step: Return A;

(3). Problems encountered during commissioning and solutions

Problem:

Workaround:

Topic 3: (1). PTA Submission List (2). Design ideas

1. The first step:
2. Step Two:
3. Step Three:
4. Step Fourth:
5. Step Fifth:
6. Step Sixth:
7. Step Seventh:
8. The first step:
9. Step Nineth:

(3). Problems encountered during commissioning and solutions

Problem:

Workaround:

Second, peer code pairs of peer review 1. Mutual evaluation of Students name

Zheng Wei

2. My Code, mutual evaluation of the student code

My Code:

Classmate Code:

3. Where do I differ from my classmates ' code? What are the advantages? What style of code do you prefer? If the classmate code is wrong, please help to point out where the problem. Third, this week's topic set PTA Final ranking four, this week study summary 1. What have you learned?

(1).
(2).
(3).
(4).

2. This week's content, you are not what?

C Language Fifth Blog job---function

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.