C++ Notes: Summary: Header Files

Common Header Files

Most programs will use iostream, BUT there are many others that are also commonly used. The older C header file names are prefixed with the letter 'c'. Here are some of the most common.
Input / Output
#include <iostream>Stream I/O. cout and cin, istream and ostream, and endl, fixed, and showpoint manipulators.
#include <iomanip>More I/O manipulaters: eg, setw(w) and setprecision(p).
#include <fstream>File I/O. ifstream and ofstream.
#include <sstream>I/O to and from strings. istringstream and ostringstream.
C functions
#include <cassert>assert macro.
#include <cstring>C-string (array of chars) functions (strcpy(), ...).
#include <cctype>char functions.
#include <cstdlib>abs(), exit(), ...
#include <climits>CHAR_BIT (bits per char), CHAR_MIN, CHAR_MAX, SHRT_MIN, SHRT_MAX, INT_MIN, INT_MAX, LONG_MIN, LONG_MAX, ... C++ defines a numeric_limits template.
#include <cfloat>FLT_MIN, FLT_MAX, FLT_DIG, DBL_MIN, DBL_MAX, DBL_DIG, ... C++ defines a numeric_limits template.
STL (Standard Template Library)
#include <string>String type and functions.
#include <vector>Fast insertion/deletion at back, random access. Implementation: dynamic array allocation/reallocation.
#include <list>Fast insertion/deletion everywhere. No direct access. Implementation: doubly linked list.
#include <deque>Double-ended queue with fast insertion/deletion at front and back, direct access (one-level indirection). Implementation: multiple dynamically allocated blocks.
#include <stack>stack - LIFO access, based on deque.
#include <queue>queue (FIFO, based on deque) and priority_queue (retrieval of highest priority element first, based on vector).
#include <map>map and mulitmap classes. Fast lookup based on key yields single/multiple entries. Implementation: balanced binary tree.
#include <set>set and multiset containing single/multiple values. Fast lookup. Implementation: balanced binary tree.
#include <algorithm>Many algorithms for working with containers.