This work belongs courses | c language programming || |
---|---|
Where the job requires | C language I work 08 |
My aim in this course is | Skilled loop is used, while understanding and acting in the do-while loop and the use of |
This job helped me achieve that goal in terms of specific | Help me learn to use while and do-while, loop control and review |
references | C language I work 08 |
PTA lab assignments
A topic
7-5 crawling worms
data processing
- Data are expressed: the definition of an integer array a, a position for the first time, to receive the data after the three positions
- Data processing: initialization time
Fake code
scanf("%d%d%d", &a[1], &a[2], &a[3]);
Initializing depth do {began to get reduced length of time accumulating time accumulation rest decline} the while (determined whether climb out);
Output time return 0;}
Create test data
Input data | Output Data | Explanation |
---|---|---|
14 5 4 | 19 | Well long 14-inch, 5-inch worms crawl every minute, every rest on the whereabouts of the 4-inch, takes 19 minutes to climb out of the well |
19 8 6 | 13 | Well long 19-inch, 8-inch worms crawling per minute, each time to rest on the whereabouts of 6-inch, takes 13 minutes to climb out of the well |
17 8 5 | 7 | Well long 17-inch, 8 inch worms crawl every minute, every rest on the whereabouts of the 5-inch, 7 minutes to climb out of the well |
PTA submit a list and description
Began to compile error is scanf statement missed one percentage symbol, the second part of the answer is correct because the do-while loop in the array a [1] missed one "- '
1.1.2 Screenshot experiment code
Topic two
7-2 Han soldiers
data processing
- Data are expressed: Defines the number of variable i
- Data processing: --for use of loop statement, and by means of the if statement, to use the expression (i% 5 == 1) && (i% 6 == 5) && (i% 7 == 4) && ( i% 11 == 10)
Screenshot experiment code
Fake code
include <stdio.h>
main int (void)
{
int i; define the number of soldiers Han band i
for (i = 1;; i++) {for语句需要的条件,累加人数
if ((i % 5 == 1) && (i % 6 == 5) && (i % 7 == 4) && (i % 11 == 10)) {if语句需要的条件 printf("%d\n", i);输出人数i return 0; } }
}
Create test data
Input data | Output Data | Explanation |
---|---|---|
i % 5 == 1) && (i % 6 == 5) && (i % 7 == 4) && (i % 11 == 10 | 2111 | Han Xin soldiers have 2111 |
PTA submit a list and description
Code peer assessment
Students Code
My code
1. The student code is irregular, dog standardized format is not
2. Compared with me, the student defines two variables, in fact, than my simple,
Students Code
My code
- The student code is relatively simple, but people seem relatively easy to understand
- Overall comparison, he uses the while statement, and I'm using an array of students taught me
Learning progress bar
Currently more confusing issues | Learned knowledge Introduction | Lines of code | This week the time spent | Week / Date |
---|---|---|---|---|
Do-while using the structure | And while using a loop statement | 1200 | 6h | 11.13 |
Cumulative code and blog words
Learn insights and experience
Learn sentiment
- Work is now able to promptly and quickly completed, but will often not pay attention to their own definition of variables
- Review of the loop, and further study the while statement and the do-while structure
Realizations
This week we learned do whlie and while loops, and more honest to put himself in private tuition