*** C language operations 08

This work belongs to the curriculum C language program II
Where the job requires [Operational requirements] https://edu.cnblogs.com/campus/zswxy/SE2019-1/homework/9980
My aim in this course is Learn to use a while loop
This job helped me achieve that goal in terms of specific pta special operations summarize, consolidate the use of the while loop
references [Evaluation Criteria] https://www.cnblogs.com/pengchen511/p/10564067.html

**** Third, the work week,
PTA lab assignments
Code peer assessment
study concluded
**** Fourth, the job format
***** 1.PTA experimental work (20 points / questions)

From the PTA elected two focus topics you are most satisfied with the completion of the following topics, select the greater difficulty of the subject, the higher the score, each question 20 points (5 points each), content requirements are as follows:

***** 1.1 1 topic name
title Description
7-1 integer number of bits required and you figures and
for a given positive integer N, the number of bits required it and the sum of the digits.
***** 1.1.1 Data processing
data expressed: defines the integer variable N, c, s, represents a positive integer input, increment variable, and the number of each.
Data processing: the expression: s + = N%, N / = 10, while loop

Definition of variables;
input N;
the while (expression) // use the cyclic structure, the number of bits to obtain accumulated summation.
{s + = N%; N / = 10; c ++;}
The output
***** 1.1.2 experiment code theme

***** 1.1.3 making test data

Entry Export Explanation
375 3 15 random
947 3 20 random
123 3 6 random

***** 4 PTA submit a list and description

Submit a list of instructions:
1. Compile error: Error own when Dev c ++, appearing, at the time of the reasons for the use of the while loop, the condition is wrong, leading to enter an infinite loop.
2. Wrong Answer: When you use the expression, then take over first division, resulting in less time to run once, jumped out of the loop.
3. partially correct: the definition of uninitialized variable values.
***** 1.2 Problem 2
7-5 crawling worms (15 minutes)
a length of 1 inch worm, the bottom of a deep N well inch. The worm is known inch per minute to climb U, but must then rest for 1 minute to climb. During the break, the worm has dropped D inch. In this way, climb and glide repeated. I ask, how long it takes to climb out of worms well?

Here requires less than 1 minute in 1 minutes, and assuming that as long as a particular climb during the worm's head reached the top of the well, then the worm to complete the task. Initially, the worm is lying at the bottom (i.e., the height of 0).
***** 1.2.1 Data processing
data expressed: defines the integer variable N, D, U, X, Y, respectively, the number of wells inch, one minute decline few inches, within one minute climb inch Number , climb over a few inches, the time used by
the data processing: X = X + U, X = XD, using a while loop

Definition of variables;
input N, D, the U-;
the while (X <N) is calculated by the circulation time //
{calculate time and distance to go;
the IF (X-> = N) {} // BREAK creeping distance is greater than the depth of the
falling time ;
output time;}

***** 1.2.2 Code Screenshot

***** 1.2.3 build test data

Entry Export Explanation
12 3 1 11 random
65 4 7 1431655766 random
25 5 3 21 random

***** 1.2.4 PTA submit a list and description

1. Wrong Answer: mistaken climb and fell at the same time, that is, X = N / (UD), resulting in operating results for the 6
2. Ask assistant to sort out meaning of the questions. . Code to initialize the variable values remember
***** 2 Code peer assessment (5 points)
to find classmates Code 2 parts, and their own code comparison, the proposed peer review of code to try to find coding style quite different.

Screenshot students Code

Own Code Screenshot

2 parts of 1,2,3 list mode code in the different places.
1. roughly the same as my first student code, that while the statement is a constant expression 1, expression of the if statement is n-1 represents the distance from the wellhead to the head of the insect.
2. The students are using a do while statement cycle, the first cycle and then determine the conditions.
3. The two students will initialize the value of a variable, but I only initialize one, I lifted the former is more rigorous.
***** 3. The study concluded (15 points)
***** 3.1 Learning progress bar (5 points)

Week / Date This week the time spent Lines of code Learned knowledge Introduction Currently more confusing issues
3/9-3/15 9+ 80 Integer and floating-point type, If-else language Reading the code jargon
10/9-17 10+ 96 Use the loop, integer and floating-review Call, defined functions
10/20-25 11+ 105 Call, defined functions Use of various functions
10/28-11/1 11+ 127 Multi-branch structure, logic operations logical thinking
11/4-7 12+ 178 Familiar multi-branch structure, switch statements Flexible use of the switch statement
11/10-15 14+ 194 and do while statement while statement All while flexibly statement

***** 3.2 cumulative word lines and blog (5 minutes)

***** 3.3 summarizes the learning content and sentiment (5 points)
***** learning content summary 3.3.1

***** 3.3.2 learning experience
slowly learn, feel writing code have their own ideas, he can take the initiative to think, sometimes a little upset, but also fun. Come on.

Guess you like

Origin www.cnblogs.com/yangranran/p/11863535.html