课程: Complete Guide to C Programming Foundations
今天就学习课程吧!
今天就开通帐号,24,100 门业界名师课程任您挑!
Nesting loops
- [Instructor] There's really nothing a for loop can do that a while loop cannot do. Though there's one thing you can do better with a for loop than a while loop, and that's nesting loops. A nested loop is one loop inside another, as this exercise file demonstrates. The outer loop uses variable row to count from one through 10. The inner loop uses variable column to count from value letters A through J. The printf statement outputs the current row and column values plus three spaces. And a putchar statement at line 14 adds a new line character to the end of each line output, making a nice, neat grid. Run to see the nice, neat grid. And there it is. Nested loops are most frequently related to information shown in grids. The outer loop repeats only after the inner loop is done repeating a given number of times. This exercise file shows the while loop version of the same code, because the while loop statement contains only the looping condition for additional statements that are required…
内容
-
-
-
-
-
-
Making a decision3 分钟 25 秒
-
(已锁定)
Exploring the possibilities2 分钟 53 秒
-
(已锁定)
Using the ternary operator3 分钟
-
Working with the switch-case structure4 分钟
-
(已锁定)
Challenge: Select an item28 秒
-
(已锁定)
Solution: Select an item1 分钟 45 秒
-
Creating a for loop3 分钟 36 秒
-
(已锁定)
Setting up a while loop2 分钟 58 秒
-
(已锁定)
Challenge: Repeat some text51 秒
-
(已锁定)
Solution: Repeat some text1 分钟 51 秒
-
(已锁定)
Nesting loops1 分钟 59 秒
-
(已锁定)
Breaking out of a loop3 分钟 16 秒
-
(已锁定)
Avoiding the goto keyword1 分钟 33 秒
-
(已锁定)
Chapter challenge: Interpreting commands2 分钟 26 秒
-
(已锁定)
Chapter solution: Interpreting commands3 分钟 55 秒
-
-
-
-
-
-
-
-