The C++ vector Class

The C++ vector is basically a variable-length array. To use it, you have to #include <vector>. You can add something to the end of a vector by calling vec.push_back(element). You can get or set the (n + 1)th element using vec[n], just like you would with an array. You can determine the number of elements in a vector by calling vec.size(). It can also do plenty of other things. (It slices, it dices, it does your homework and makes you breakfast.) And, to declare a vector of ints, for example, you use vector<int>.