The C++ ‘#include’ Statement

The C++ programming language contains a vast array of functionality, known as the C++ Standard Library, which is split up in to what are called header files. In order to use the functionality within these files, they must first be included at the top of the program, using the ‘#include’ statement. The ‘#include’ statement is one of a number of pre-processor commands, which informs the compiler to do something prior to compilation, in this case, include the header file.

#include <header-file-name>

Below is a list of some of the header files available, along with a brief description of the functionality that they contain.

File Name Description
cmath Contains common mathematical functions.
cstring Provides functionality to handle C-style strings.
ctime Includes functionality to retrieve and manipulate date and time information.
exception Provides functionality to handle exceptions.
filesystem Facilitates interaction with the file system.
iomanip Includes functionality to control the format of input and output.
iostream Short for input/output stream, this includes standard input/output functionality.
locale Location specific functionality to determine items such as the date format and currency symbol.
random Provides functionality to generate random numbers.
regex Allows for the use of regular expressions, which are used to perform pattern matching within strings.
string Provides functionality to handle C++ style strings.
utility Includes general utility functionality.