Collection classes

Several of the classes represent collections of other objects.These collections work in much the same way as the similar classes in the Standard Template Library (STL).

Each of these collections is documented in its own page, along with sample code. This documentation has been updated for Fall Quarter 2020.
Vector<ValueType> A Vector is an indexed sequence of values similar to an array.
Grid<ValueType> A Grid is an indexed, two-dimensional array.
GridLocationA GridLocation is a row/col pair.
Stack<ValueType> A Stack is a linear structure in which values are added and removed only from one end, LIFO.
Queue<ValueType> A Queue is a linear structure in which values are added at one end and removed from the other, FIFO.
PriorityQueue<ValueType> A PriorityQueue is a specialized queue in which values are processed in order of priority.
Map<KeyTypeValueType> A Map maintains an ordered association between keys and values.
HashMap<KeyTypeValueType> A HashMap is a highly efficient and unordered implementation of the Map abstraction.
Set<ValueType> A Set is an ordered collection of distinct values.
HashSet<ValueType> A HashSet is a highly efficient and unordered implementation of the Set abstraction.
Lexicon A Lexicon is a highly efficient implementation of a word list.

Utility header files

These headers export various utility functions, grouped thematically. Some of these have been updated for Fall Quarter 2020; others are pending updates.
direction.h This file exports an enumerated type called Direction whose elements are the four compass points: NORTH, EAST, SOUTH, and WEST.
error.h This file defines the ErrorException class and the error function.
filelib.h This file exports a standardized set of tools for working with files.
random.h This file exports functions for generating pseudorandom numbers.
shuffle.h This file exports a set of functions that randomly rearrange arrays, grids, and vectors.
simpio.h This file exports a set of functions that simplify input/output operations in C++ and provide some error-checking on console input.
strlib.h This file exports several useful string functions that are not included in the C++ string library.
timer.h This file exports a class for measuring intervals of time.
tokenscanner.h This file exports a TokenScanner class that divides a string into individual logical units called tokens.

Graphics and media

This is documentation for GUI objects. These pages have not yet been updated for Fall Quarter 2020.
console.h This file redirects the cin, cout, and cerr channels to use a console window.
gevent.h This file defines the event types used in the StanfordCPPLib graphics libraries.
ginteractors.h This file exports a hierarchy of graphical interactors similar to those provided in the Java Swing libraries.
gmath.h This file exports several functions for working with graphical geometry along with the mathematical constants PI and E.
gobjects.h This file exports a hierarchy of graphical shapes based on the model developed for the ACM Java Graphics.
gtimer.h This file defines the GTimer class, which implements a general interval timer.
gwindow.h This file defines the GWindow class which supports drawing graphical objects on the screen.
sound.h This file defines a class that represents a sound.