Modules


    

Table of Contents

  1. Definition
  2. Examples

Definition

C++ Standard library functions or C++ Library functions are built-in functions in C++ programming that will help us access functions. The prototype and the definitions of the functions are stored in their respective header files. Therefore, to access an inbuilt function in C++, you need to include the header file in your C++ file.
One example is the cout function that is accessible because we include the header file library iostream on top of our program.

Examples

These are some examples of the commonly used C++ Library header files. Some of them are based on the one in C Library, for example cstdio, cctype, cmath, etc. If you have prior experience in C programming, then you can include this library in your C++ program and write C code. In simpler terms, you can use code C language in C++ file as long as you include the library.

C++ Header File Description Some Examples
<cassert> Program assertion functions assert()
<cctype> Character type functions isalnum(), isdigit(), tolower()
<locale> Localization functions use_facet, has_facet
<cmath> Mathematics functions log(), sqrt(), sin(), cos()
<iomanip> Stream manipulator functions setprecision(), setfill(), setbase()
<fstream> Input/output from files functions ifstream, ofstream
<string> String handling functions string, char_traits
<iostream> Standard input/output functions cout, cin, cerr, clog
<cstdlib> Standard utility functions abort(), exit()
<cstring> C string (character array) handling functions strcpy(), strcat(), strncat()
<ctime> Date time functions difftime(), time(), clock()
<cstdio> C standard input output functions printf(), scanf(), getchar()