CPS 6, Ramm - Summer Semester I - 6/17/99 #19
Chap 8. Arrays, Data, & Random Access
- A Character Plotting Program
- Use matrix like a canvas
- "Plot" prints out matrix
-
charplot
Chap 9. Characters, Strings, & Streams: Abstraction
and Information Hiding
- Strings are Vectors of Characters
- Use indexing operator [] to get char
- Don't get out of range!
- Can both access and change characters
- Can also access characters (as strings) with .substr(pos,len)
- Reverse Order of Characters in a String
- Convert Characters to Strings
- Strings with one element are not characters.
- Can convert char to string using string(char)
-
capital.cc
- String Streams
- Read from String as if it were a file.
- Use getline() to
read line from file stream or cin
- Use istrstream to
read info from string.
- Daily Sales Ticket Processing
- More Scope
- Global
- Scope Resolution Operator
- Lifetime
- Normal (automatic)
- Static
- Global
- Dynamic (new, delete)
Chap 11. Sorting, Algorithms, & Matrices
- Selection Sort
- Find smallest; swap with element [0]
- Consider rest of list [1], [2], ...; find smallest,
swap with element [1]
- Continue process until you get to end
- Complexity
- Function Overloading