CPS 6, Ramm - Spring 2000 - 2/21/00 #14
Chapt 6. Classes, Iterators, and Patterns
- Extrema, Statistics
-
stats1.cpp
-
stats2.cpp
- Initialize with real data
- Type Casting (coercion)
- Change one type to another
- Only defined where it makes sense
- Several different forms exist
- E.g., changing int to double
- double(n)
- (double) n
- Using Reference Parameters
-
stats3.cpp
-
stats4.cpp
- Text Processing Example
- Design Issues
- Moving Functionality to Functions
- Use of Reference Parameters
-
format.cpp
-
formatwatch.cpp
- More Reference Parameters (tricky)
-
ref.cpp
Chap 7. Class Interfaces, Design, and Implementation
- Switch Statement
- switch ( expression )
- {
- case constant1:
- statement list;
- break;
- case constant2:
- statement list;
- break;
- ...
- default:
- statement list;
- }
- Example Using the Switch Statement