CPS 6, Ramm - Summer Semester I - 6/6/00 #13
- Announce
- Lab Today
- Quiz Friday
- Individual Meetings (continue)
7. Class Interfaces, Design, & Implementation
- Quiz Program
- Includes Student and Quiz Classes
-
quiz.cpp
- Preprocessor
- #include files, missing?
- #ifndef, #define, #endif
- multiple copies of include files
- Compiler
- Linker
- Undefined symbols
- Missing modules
- Alternate Question Class (State Capitals)
- Includes Student and Quiz Classes
-
capquest.cpp
-
capquest.h
- Frogs that can't make up their minds ...
- Random Walks (1-D)
- Physics
- Statistical
- Coin Toss
- Frog Example
- Gambling Example
- Random Walk Class
- Random Walks (2-D)
- Passing a Class by Value/Reference
- Done for strings many times...
-
scopedice.cpp
- Structs
- Similarity to Class
- All Public, No Private
- Can Have Member Functions
- An Aggregate of Dissimilar Types
- Example (without member functions)
- struct Student
- {
- string name;
- int height; // height in inches
- double weight; // weight in pounds
- string dob; // date of birth mm/dd/yy
- }
Chap 8. Arrays, Data, & Random Access
- Concepts
- Random Access
- Sequential Access
- Arrays, Vectors
- A Counting Problem
-
gradefreq1.cpp
-
gradefreq2.cpp
-
gradefreq3.cpp
- Vector Vocabulary
- Homogeneous Collection (Aggregate)
- N cells/elements
- index/subscript (0, 1, ..., N-1)
- always start at 0
- last always at N-1