C++ algorithm Library

C++ algorithm Library

The <algorithm> library has many functions that allow you to modify ranges of data from data structures.

A list of useful functions in the algorithm library can be found below. Continue reading C++ algorithm Library

C++ vector Library

C++ vector Library

The <vector> library has many functions that allow you to perform tasks on vectors.

A list of popular vector functions can be found in the table below. Continue reading C++ vector Library

C++ cstring Library

C++ cstring Functions

The <cstring> library has many functions that allow you to perform tasks on arrays and C-style strings.

Note that C-style strings are different than regular strings. A C-style string is an array of characters, created with the char type. To learn more about C-style strings.

A list of all cstring functions can be found in the table below. Continue reading C++ cstring Library

C++ string Library

C++ string Functions

The <string> library has many functions that allow you to perform tasks on strings.

A list of popular string functions can be found in the table below. Continue reading C++ string Library

C++ cmath Library

C++ Math Functions

The <cmath> library has many functions that allow you to perform mathematical tasks on numbers.

A list of all math functions can be found in the table below: Continue reading C++ cmath Library

C++ iostream Library

C++ iostream objects

The <iostream> library provides objects which can read user input and output data to the console or to a file.

A list of all iostream objects can be found in the table below. Continue reading C++ iostream Library

C++ Keywords

C++ Keywords

A list of useful keywords in C++ can be found in the table below. Continue reading C++ Keywords

C++ Iterator

C++ Iterators

Iterators are used to access and iterate through elements of data structures (vectors, sets, etc.), by “pointing” to them.

It is called an “iterator” because “iterating” is the technical term for looping.

To iterate through a vector, look at the following example:

Example

// Create a vector called cars that will store strings
vector<string> cars = {"Volvo", "BMW", "Ford", "Mazda"};

// Create a vector iterator called it
vector<string>::iterator it;

// Loop through the vector with the iterator
for (it = cars.begin(); it != cars.end(); ++it) {
  cout << *it << "\n";
}

Continue reading C++ Iterator