This directory contains sources for various application programs from the book Data Structures in C++ using the STL.
File Name | Where Found in Book | Description |
---|---|---|
war.cpp | Chapter 2 | The game based on the card game WAR. (The human player variation is found in file hwar.cpp). |
Hanoi.cpp | Chapter 3 | Towers of Hanoi recursive routine |
bubblesort.cpp | Chapter 4 | Bubble Sort, with driver test program. |
insertionsort.cpp | Chapter 4 | Insertion Sort, with driver test program. |
palindrome.cpp | Chapter 7 | The palimdrome tester from chapter 7. |
split.cpp | Chapter 7 | The split function, with test driver. |
simstring.h | Chapter 7 | Header file for simplified implementation of the STL string data type. |
simstring.cpp | Chapter 7 | Implementation file for simplified version of the STL string data type. |
mSort.cpp | Chapter 8 | Merge sort algorithm, with test driver |
sVector.h | Chapter 8 | A simplified version of the STL vector data type. |
inventory.cpp | Chapter 9 | Inventory example program |
sList.h | Chapter 9 | A simplified version of the STL list data type (see errata list for changes) |
olist.h | Chapter 9 | The ordered list class definition. Requires that the list class be previously defined. |
rpn.cpp | Chapter 10 | Reverse Polish Notation Calculator program |
inToPost.cpp | Chapter 10 | Infix to Postfix conversion |
bank.cpp | Chapter 10 | Bank Teller Simulation, test of queue data type |
maze.cpp | Chapter 11 | Maze solving program, uses file mazeone |
knight.cpp | Chapter 11 | Knights tour problem, uses file backtrack.h |
sDeque.h | Chapter 11 | A simplified version of the STL deque data type |
bitset.h | Chapter 11 | A simplified version of the STL bitset data type |
sieve.cpp | Chapter 11 | Prime seive program, test of bitsets |
sSet.h | Chapter 12 | A simplified version of the STL set data type |
animal.cpp | Chapter 13 | Guess the animal game |
treeSort.cpp | Chapter 14 | tree Sort, with driver test program. |
quickSort.cpp | Chapter 14 | quick Sort, with driver test program. |
heapSort.cpp | Chapter 15 | heap Sort, with driver test program. |
prior.h | Chapter 15 | A simplified version of the STL priority queue data type. |
iceCream.cpp | Chapter 15 | Ice cream store simulation, uses event.h |
silly2.cpp | Chapter 16 | silly sentence generation, uses grammar |
Comments on Sources:
Most of the sources were originally developed on the Mac using CodeWarrior version 9. Most have been tested on a unix system using g++ version 2.7.2.
On some systems (such as g++) a confusion can arise between multiple definitions of the string relational operators other than less-than -- this is due to a template definition that redefines all other operators in terms of the less than operator. The only solution I've found is to only use the less-than operator with strings.
The const operator (and lack thereof in my code) causes some difficulties on some systems. So far I haven't been able to find a consistent pattern to follow in describing the changes that need to be made to the code provided here.
CodeWarrior 11 seems to be a giant step backwards. Containers must be declared with allocators, and if you use nonstandard elements (such as pointers) you must declare iterator traits classes. I have not attempted to update the sources for this platform, as metroworks claims that many of these problems will be fixed in CW 12. (locally, we didn't install CW 11, and still use CW 10).
Finally, if anybody wishes to describe how the sources must be modified for any particular platform, send me a message at budd@cs.orst.edu.