CPS 6L.2 Ramm - Fall 2001 - 9/17/01 #10
- Announce
- Sample Problems for Friday's Quiz
- Lab #3
- Assignment #2
5. Iteration with Programs and Classes
- Defining Constants
- Syntax:
-
const type identifier = value;
- Style: use all caps for identifier
- e.g. const double PI = 3.14159265;
- Iteration (post-tested)
- initialization
- loop body
- update
- loop test
- Pre-tested and Post-tested Loops
-
do-while Loop Syntax
- do
- {
- statement list
- } while ( test expression )
- Using the
do-while Loop
addwhile.cpp
-
break Statement
- Nested Loops
multable.cpp
- Nesting can be hidden by using function
- A look at the Balloon Class