CH08 - An Introduction to Programming with C+, Fifth...

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

View Full Document Right Arrow Icon
An Introduction to Programming with C++, Fifth Edition 8 - 1 Chapter 8 More on the Repetition Structure At a Glance Instructor’s Manual Table of Contents Chapter Overview Chapter Objectives Instructor Notes Quick Quizzes Discussion Topics Classroom Activities/Additional Projects Key Terms
Background image of page 1

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

View Full DocumentRight Arrow Icon
An Introduction to Programming with C++, Fifth Edition 8 - 2 Lecture Notes Chapter Overview This chapter covers topics related to the repetition structure not covered in the previous chapter. The emphasis of this chapter is to implement the posttest form of the repetition structure. Included is the implementation of the repetition structure in C++ using the do statement. The concept of nested repetition structures will also be covered. Chapter Objectives After completing the chapter, the student will be able to: Include the posttest repetition structure in pseudocode and in a flowchart Code a posttest loop using the C++ do statement Nest repetition structures Instructor Notes Posttest Loops A repetition structure can either be a pretest loop or posttest loop. In a pretest loop, the loop condition is evaluated before the instructions within the loop are processed, while in a posttest loop, the evaluation occurs after the instructions within the loop are processed. Of the two types of loops, the pretest loop is the most commonly used. You will cover the posttest loop in this chapter; the pretest loop was covered in the previous chapter. With very rare exceptions, every loop has a loop condition and a loop body. The loop condition appears at the bottom of a posttest loop and determines if the instructions within the loop, referred to as the loop body, will be processed additional times. Remember that the loop body will be processed at least once in a posttest loop. Similar to a selection structure condition, a loop condition must result in either a true or false value (a boolean value). When the loop condition evaluates to true, the one or more instructions listed in the loop body are processed again. If the loop condition evaluates to false, the instructions listed in the loop body are not processed again and control is passed to the next statement after the loop. Because the loop condition in a posttest loop is evaluated after the instructions within the loop
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 03/11/2010 for the course CS 343 taught by Professor Katzman during the Spring '09 term at ITT Tech Tucson.

Page1 / 6

CH08 - An Introduction to Programming with C+, Fifth...

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