208 Day 10 Repititon3

208 Day 10 Repititon3 - 4002-208Intro to Prog[in C]Day...

Info iconThis preview shows pages 1–7. 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 DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight 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 10Yet more on RepetitionObjectives•Basics of the do-while statement•Using do-while for a "Yes/No" loop•Writing a do-while for data validation•Writing a while loop to act as a for loop4002-2082Review of Loop Structures•Pre-test loop–while loop–for loop–Condition is tested before the loop body is executed.•Post-test loop –do-while loop–condition is tested after the loop body is executed.4002-2083Pre-test loopswhile (loop condition){loop body}Note: NO semi-colon after while linefor (initialization ; loop condition ; change){//code to repeat}Note: NO semi-colon after for line.4002-2084do while loopdo{//code to be executed}while (condition);Note: There is a semi-colon after condition.4002-2085Basics•Loop body is executed once before loop condition is tested.•The loop continues as long as the condition remains true. •Loop exits when condition becomes false for the first time....
View Full Document

Page1 / 13

208 Day 10 Repititon3 - 4002-208Intro to Prog[in C]Day...

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

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