208 Day 07 repetiton1

208 Day 07 repetiton1 - 4002-208Intro to Prog[in C]Day...

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 4002-208Intro. to Prog. [in C++]Day 07RepetitionObjectives•Basics of a loop•Overview of 3 loops in C++•Mechanics of a while loop•Use of while loop for data validation•Writing code to validate input 4002-2082Basics•Group of statements will be executed multiple times – loop body•A condition determines when the loop exits – loop condition•Any type of statements can be inside the loop including other loops.4002-2083Questions•What is the group of statements to be repeated?•What is the condition to stop the repetition?•Is condition tested before or after the group of statements?Before: pre-test loopAfter: post-test loop4002-2084Overview of loops in C++•while loop–Pre-test loop•for loop–Pre-test loop–Used mainly as counting loop–Used with arrays to increment index•do-while loop–Post-test loop4002-2085while loopwhile (loop condition){loop body}Loop condition is a Boolean conditionSame as an if statement4002-2086Details•Loop condition is tested. If condition is...
View Full Document

{[ snackBarMessage ]}

Page1 / 13

208 Day 07 repetiton1 - 4002-208Intro to Prog[in C]Day...

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

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