CPS 6, Ramm - Summer Semester I - 5/28/01 #8
- Announce
- Quiz Today
- No lab tomorrow
- Hour Test on Wednesday
- Review session tomorrow
- Next "Quiz"
Chapt 5. Iteration with Programs and Classes
- Defining Constants
const type identifier = value;
all caps
- Pre-tested and Post-tested Loops
- Iteration (post-tested)
- initialization
- loop body
- update
- loop test
-
do-while Loop Syntax
- do
- {
- statement list
- } while ( test expression )
- Using the
do-while Loop
addwhile.cpp
- Infinite Loops
-
break Statement
- Nested Loops
multable.cpp
nesting can be hidden by using function
- Scope of Variables
- definition
- braces { }
- Private Variables
- Global Variables (XXX)
- Class Example: Random Numbers & N-sided Dice
- Class:
dice
- Using dice
roll.cpp
- Class Diagram
- Public
- constructor
- member functions
- Private
- Constructors
- The Dice Interface
dice.h
"Declaration" not code (not Definition)
- Dice Implementation
dice.cpp
- Dice/While Example
roll300.cpp
"Validate" by Inspection ?
- The Date Class
- Many constructors
- Look at header for interface
date.h
- Monday Blues
mondays.cpp