Chap06 - Chapter6 LOOPING CHAPTER GOALS To be able to...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 6 LOOPING CHAPTER GOALS To be able to construct syntactically correct While loops. To be able to construct count-controlled loops with a While statement. To be able to construct event-controlled loops with a While statement. To be able to use the end-of-file condition to control the input of data. To be able to use flags to control the execution of a While statement. To be able to construct counting loops with a While statement. To be able to construct summing loops with a While statement. To be able to choose the correct type of loop for a given problem. To be able to construct nested While loops. To be able to choose data sets that test a looping program comprehensively. CHAPTER OUTLINE I. The While Statement II. Phases of Loop Execution III. Loops Using the While Statement A. Count-Controlled Loops B. Event-Controlled Loops 1. Sentinel-Controlled Loops 2. End-of-File-Controlled Loops 3. Flag-Controlled Loops C. Looping Subtasks 1. Counting 2. Summing 3. Keeping Track of a Previous Value IV. How to Design Loops A. Designing the Flow of Control 1. Count-Controlled Loops 2. Sentinel-Controlled Loops 3. EOF-Controlled Loops 4. Flag-Controlled Loops B. Designing the Process Within the Loop C. The Loop Exit V. Nested Logic A. Designing Nested Loops Theoretical Foundations : The Magnitude of Work VI. Problem-Solving Case Study : Average Income by Gender VII.Testing and Debugging A. Loop Testing Strategy B. Test Plans Involving Loops 1. Counter-Controlled Loops 2. Event-Controlled Loops C. Testing and Debugging Hints VIII. Summary
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
GENERAL DISCUSSION The most significant new concept in this chapter is that statements may be executed over and over until some condition is met. The loop is the third of the four flow-of-control mechanisms. The fourth is the subprogram, which is the topic of Chapters 7 and 8. In Chapter 6, we cover only While statements. Some instructors prefer to cover all three of the C++ looping statements together, but we strongly disagree with this practice. Our own experience has been that covering Do-While and For together with While serves only to confuse the slower students. We also have found that presenting all three loops at once does not give the advanced students any better appreciation for the differences between the loops than does presenting those differences later. We believe that students have enough trouble learning the basic concepts of looping without also having to learn three different syntaxes and a set of ill-defined rules for choosing among them. By learning all of the basic types of loops using a single syntax, the student gains a conceptual understanding of the functions of the different loops in relation to one another. This avoids the common misconception that certain looping operations are strictly associated with one or another of the C++ looping statements. In other words, the students experience the versatility of the most commonly used general-purpose loop construct. Once they have done so and have been given time to practice using loops, they can pick up the
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/13/2011 for the course CSC 140 taught by Professor Lebre during the Spring '04 term at Moraine Valley Community College.

Page1 / 17

Chap06 - Chapter6 LOOPING CHAPTER GOALS To be able to...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online