First, chapter review:
Cycle. A syntactic form that executes a sentence repeatedly.
1. Basic syntax:
for (initial condition; cyclic condition; change of State)
{
Loop body
}
The four elements of the loop.
The execution process of the loop. Initial conditions--cyclic condition--cyclic body--state change--Cyclic condition--。。。。。
Case: 1. Print 10 hello. 2. Displays 1-100 of the number (all, odd, even). 3. Display ASCII code.
2. Looping the nesting.
for (...; ... ; ...)
{
for (...; ...; ...)
{
}
}
Case: Print a variety of graphics--outer loops, print lines. Inner loop, print column.
3. Application (iteration, exhaustive)
Iteration: According to a certain rule, the pass cycle gradually deduces the final result. The result is not correct often is the method has the problem, the method is incorrect often is the thought has the question.
The most important thing is to find out the law of the iteration and express it in an expression.
Case:
1.100 or less of all numbers.
2. Factorial
3. Age deduction.
4. Origami. Put food on the board.
5. Monkeys eat peaches.
6. Drop the ball
7. Rabbits give birth to rabbits.
Exhaustive: take all possible situations and find the conditions that meet the requirements.
The most important thing is to see if it can be solved with a poor lift, and how to write out the poor grammar.
Case:
1.100 or less of 7.
2. Coin combination problem. The 1,2,5 combines 1 hairs of 5来.
3. Buy something. Toothbrush, body soap, shampoo.
4. Hundred Chicken Hundred Money, hundred Ma Baishi.
5. Scout
6. Equation Fill operator
C#5 Review summary of cyclic iterations and poor lifting