First, the PTA laboratory work Problem 1:6-5 use a function to output an integer in reverse order 2. Design ideas
- The first step: Define an integer variable a=0;
- The second step: Calculate the A=A*10+NUMBER%10,NUMBER=NUMBER/10;
- Step three: If number>0, repeat step 2;
- Fourth step: Return a to main function;
3. Problems encountered during commissioning and solutions
Problem: Do not know how to represent the number of reverse order, and first use count to find the number digits, and then through the nested loop representation;
Solution: Through pseudo-code, find the law of reverse order number, never easy code;
4. PTA Submission List
Topic 2:6-6 using functions to output daffodils number 2. Design ideas
- The first step: Define 2 Integer variable I,J to represent the loop variable, define the integer variable count to represent the number of digits, a for the input number, b for the number of each position, C for storing the number on each bit of the n power, sum stores the number of each bit on the power of the N;
- The second step is to calculate the n power of the number on each bit by calculating how many digits count A has, using the number of cycles equal to count.
- The third step: if the number on each bit is equal to the sum of N of the input, return the result 1, otherwise return the result 0;
- Fourth step: Then use void function, define the integer variable i, if the loop satisfies narcissistic (i) = = 1, then output i;
3. Problems encountered during commissioning and solutions
Problem: The run time-out has always been, but the calculation method has no errors.
By debugging I found no limit to my results, I would output the result indefinitely, because there is no number defined by count, which results in this consequence.
4. PTA Submission List
Topic 3:7-1 Combinatorial number 2. Design ideas
Main function
1. Define integer variable m and n,double type variable result;
2. Enter m and N;
3.result=fact (n)/(Fact (M)fact (n-m));
4. Output result;
Fact function
1. Incoming data n;
2. Define a double type variable result=1,int type loop variable i;
3. Calculate Result=result i in the loop;
4. Return the value of result;
3. Problems encountered during commissioning and solutions
Problem: Partially correct, m/n error;
Define result as a double-precision floating-point variable;
4. PTA Submission List
Second, this week's topic set PTA Final Ranking
Peer code pairs of peer review 1. Peer Reviews Photos
2. My Code, mutual evaluation of the student code
I
Chi Bin
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.
I and Zhi bin code a lot of similarities, because this topic is we discussed together, but my relative omitted some of the unnecessary steps. Overall I think this topic is relatively simple, there are few problems.
Iii. Summary of this week's study 1. What have you learned?
What data types are 1 C languages?
There are int type, float type, double type, char type, short type, long type, undesigned type, Longlong type.
2 character type data need to be aware of the place?
Note that character data can only hold one character, so extra spaces and carriage returns will occupy this character.
3 self-increment decrement operator?
After n++, the value of n is added to 1, but the value of n++ is equal to the original N. After ++n, the value of n is added to the value of 1,++n plus 1.
Self-reduction is the same as self-increment.
1.4 Operator Precedence?
2. What do you not have in this week's content?
Can't remember a lot of knowledge points, nor use. The function question does not understand, does not do. See the code of the classmate can not understand, heart tired.
3. What difficulties do you encounter and how do you plan to solve them?
Feel the knowledge of the previous learning points can be mastered, but the code will not, there are some problems usually hit the code will, but a test will not. Like regular code to students actively consult.
Summary of the examination on the machine
In the heart received 10,000 critical hit, very hit, suspect that they really are not suitable for learning computer. The train of thought is intermittent, the whole mentality is basically not. Usually very simple to judge the prime number of the two conditions actually will forget, if not the teacher reminds, simply unexpectedly. For the character type output, usually will use, an examination does not know how to play ' A ' this character. Arithmetic problem can not understand test instructions, do not know the topic want to express what, feel their brains blank. Even if you try not to mind, you can see the passage of time in vain. Think of their own cycle of learning will be, the results of the exam so many problems. Then this week's function question basically does not write, does not know that the machine test will be how the blow.
C Language Blog Job--function