C Language Blog Job--function

Source: Internet
Author: User

One, the PTA laboratory work title One: 6-3 use the function to determine the total square number 1. PTA Submission List

2. Design Ideas
    • 1. Define integer variable i as the loop variable, x is the return value
    • 2. If n==0, then x=1
    • 3. If n is less than 0,x=0
    • 4. If x is greater than 0, the assigned initial value is equal to 1, when I is less than or equal to n enters the loop, each cycle I value plus one
    • 5. If I multiply I equals n, then x=1, jump out of the loop
    • 6. Otherwise x=0
    • 7. Return the value of X
3. Problems encountered in commissioning process and PTA submission List status note
    • 1. Stratification is not clear enough, the first forget to put negative integers and 0 separate, after thinking understand
    • 2.0 is also the total square number, before the 0 as a non-complete square number processing, PTA submission List Display monitoring point 0 error, after correction
    • 3. Using a variety of statements, curly braces are not properly added, resulting in compilation errors, corrected by DEVC debugging
Topic 2:6-5 Use the function to output an integer in reverse order number 1. PTA Submission List

2. Design Ideas
    • 1. Define integer variable y as the inverse number of x, A is the result of x each time except 10, B is used to count the integer digits
    • 2. Make B=0,y=0,c=x
    • 3. When C does not equal 0 into the while loop
    • 4. For C except 10 rounding
    • 5.x each except one, the B value increases from 1
    • 6. When x is less than 0 o'clock D=-x, greater than 0 d=x
    • 7. Make i==b, when I is greater than 0 cycles, I value minus 1 per cycle
    • 8.a=d the remainder of each addition after 10
    • 9.D is greater than 10 o'clock, d= it except 10 rounding
    • 10.x is not greater than 10, the value of x does not change
    • 11.y=y+a*pow (i-1)
    • 12.x less than 0,y=-y,x is greater than 0,y=y, returns the Y value
3. Problems encountered in commissioning process and PTA submission List status note

It is not considered that the negative number and positive number are different in rounding and taking, and the negative number must be changed to a positive number before rounding is taken.

Second, peer code pairs of peer review 1. Peer reviews Photos.

2. My Code, peer-reviewed 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?
    • 1. The design ideas are completely different, I used nested loops, the classmate is the first to direct this three-digit number of each to show up and 4 to compare
    • 2. My code is more concise, the classmate's code is longer, but the idea is very clear, will be three digits each to pull away, see a total of several four, and I was in the cycle of each digit and four comparison
    • 3. The classmate's idea gave me the new inspiration, this question also may not use the circulation to solve, the circulation design is always a bit troublesome, the code too long also will appear too complex, two kinds of code all have the merit, difficult to divide the same
Third, this week's topic set PTA Final Ranking

Iv. Study Summary of the Week 1. What did you learn? What data types are 1.1 C languages?
    • 1. Signed integer int, data length 32 bits, signed short integer short[int], length 16 bits, signed long integer long[int] length 32 bits
    • 2. Unsigned class: Integral type Unsigned[int] length 32 bit long unsignedlong[int]32 bit short integer unsignedshort[int]16 bit
    • 3. Character type name char, data length 8 bits
    • 4. Real type (floating point type), single precision: float data length 32 bits, double precision: Double data length 64 bits
1.2 Character type data need to be aware of the place?
    • 1. The value of a character variable can be either a character or an integer, and the value of an integer variable and a character variable can be exchanged with each other.
    • 2. The case of one letter is a different character type constant
    • 3.0 and ' 0 ', the former is the integer constant, the latter is the character type constant
    • 4. Escape character: Consists of a backslash plus a character or number
1.3 Self-increment decrement operator?
    • The order of operations for 1.++n is to execute the n=n+1 first, and then the value of n as the value of n++ when it is expressed.
    • 2.n++ Order of Operations: N is first expressed as the value of n++. Then execute n=n plus one
    • 3. Note: The final n value will change after execution
1.4 Operator Precedence?
    • 1. The comma operation has the lowest priority, which is the left-to-right operation, followed by the assignment operation, which is the right-to-left operation
    • 2. Order from high to bottom: logical operator non-relational operator (Monocular-Binocular)-relational operator-logical operator and OR-conditional expression
1.5 which expressions are in C language? What do you do wrong in class, please analyze the reason here?
    • 1. The second small problem does wrong X + + is multiplied by Y as the value of X + + and the final result should be 10. Error Reason: X + + value is wrong, it is mistaken for x++=x+1
    • 2.3: Expression A+=a-+a*a, do not understand the sequence of operations, the operation has not changed the value of a in time
    • 3. Question fourth: The discriminant of 8>6 only two results, one is 11 is 0
    • 4. The title is to convert to a value, not a letter
      . # # #6 other content?
    • 1. Floating point number: The decimal point if the money is 0 can be omitted, E must have numbers before, E must be an integer
    • 2.= is an assigned value, and the value of the variable after the = number will change
    • 3. The precedence of operators can be changed by increasing the parentheses
2. This week's content, you are not what?
    • 1. Conversion between character and data type variables
    • 2. Eight binary and hexadecimal representations of antisense characters
3. Circular structure Examination Summary 1. What is wrong and how to change it?
    • 1. The first question was finally made, but the process wasted a lot of time because the definition of the variable data type was wrong
2. is the exam result satisfactory, how to improve?
    • 1. Not satisfied, usually should be good at writing homework, can't hold the mentality of coping, can write less than write
    • 2. Or rely on others, to independently solve their own completion

      3. Other summaries
    • 1. Usually it is important to do the habit of the problem
    • 2, timely summary of errors

C Language 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.