Enter your Sign-on user name and password.

Forgot password?
  • Follow us on:
Loading video...

Start Learning Now

Our free lessons will get you started (Flash® 10 required).
Get immediate access to our entire library.

Sign up for Educator.com

Features Overview

  • Get on-demand access to our complete library
  • Search and jump to exactly what you need to learn
  • Track your progress
  • Download practice and lesson files
  • *Ask questions and get answers from our community & instructors

Looping

  • Loops execute a code block more than once, as many times as needed
  • Early computing used “goto” – modern computing uses various explicit looping constructs
  • “while” loop, tests an expression for “true” before each loop – code block may be skipped completely if expression starts off “false”
  • “do-while” loop, tests an expression for “true” after each loop – code block is guaranteed to run at least once
  • “for” loop, usually has an explicit loop counter – code block is looped a very specific number of times
  • “break” leaves a loop early
  • “continue” returns to the beginning of a loop
  • Nested loops operate on each sub-item of each item
  • Nested loops should use different counters and different termination expressions, otherwise subtle bugs may be introduced
  • Here is a link that discusses various kinds of C++ loops: http://www.cplusplus.com/doc/tutorial/control/

Looping

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

Computer Science: Introduction to C++