First, the PTA Lab Assignment Topic 1: Use function to verify Goldbach conjecture 1. PTA Submission List
2. Design Ideas
- Defines the function to determine the prime number, for (i=2;i<=p/2;i++).
- If p can be divisible by an I, p is not a prime number and ends the loop.
- If the loop ends, the description p is a prime number, returns 1, otherwise returns 0.
- Define function output factorization, for (i=3;i<=n;i++)
- If I is a prime number, then k=n-i.
- If K is a prime number, the output is n=i+k and the loop is closed.
3. Problems encountered in commissioning process and PTA submission List status note
- Without taking into account the minimum value of the factorization p, the solution is to define a volume k=n-i.
Topic 2: Use the function to determine the total square number 1. PTA Submission List
2. Design Ideas
- Defines a function that returns 1 if n is the root of an integral type equal to N, otherwise returns 0.
3. Problems encountered in commissioning process and PTA submission List status note
- It is simple to think that the form of n=x*x leads to errors, and the solution is to prescribe N to see if it equals the integral type.
Topic 2: Finding the number of combinations 1. PTA Submission List
2. Design Ideas
- Define the function, sum to put the factorial.
- sum=1.0.
- If N<=1 returns 1.
- Cyclic sum=sum*i.
- Finally, the sum is returned.
3. Problems encountered in commissioning process and PTA submission List status note
- Note that n,m,n-m are all of the same type, so only one function is required.
Second, peer code pairs of peer review 1. Peer Reviews Photos
2. My Code, mutual evaluation of the student code
My Code
Code for Lake Steve Leung
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.
- No point: His code defines two variables, and mine doesn't.
- Advantage: He's right, but my on the PTA is wrong.
- Like his style of code.
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?
- Integer (short int long), float (float double), character (char), integer constant, character-type constant, and real-constant
1.2 Character type data need to be aware of the place?
- The definitions and values of integer and char variables are interchangeable.
1.3 Self-increment decrement operator?
- ++n and n++ are equivalent to N=n+1,--n and n--.
- ++n is the value that executes the n=n+1 first, and then the value of n as the expression ++n. n++, the value of n is first used as the value of the expression n++, and then the n++ is executed.
1.4 Operator Precedence?
- Elementary Operators > Single-mesh Operators > Arithmetic operators > Shift operators > Relational operators > Bitwise logical operators > Logical operators > Three mesh Operators > Assignment operators > Comma operators.
- The monocular operator, the assignment operator, the trinocular operator, and the assignment operation are combined right-to-left.
1.5 which expressions are in C language? What do you do wrong in class, please analyze the reason here?
- An assignment expression, a logical expression, a conditional expression, a relational expression.
- Nothing wrong.
2. This week's content, you are not what?
- Some data types and computational relationships are not yet proficient.
- The conversion between the binaries is not very good.
3. Circular structure Examination Summary 1. What is wrong and how to change it?
3,4,5 did not do, the third problem because forget the prime number of judgment method, the fourth question does not understand the conversion between the system, the fifth question did not point thinking.
2. is the exam result satisfactory, how to improve?
Not satisfied, after more practice exercises, as soon as possible to understand the meaning of the topic, continue to master the basic knowledge.
C Language Blog Job--function