C++ Libraries

The C++ Standard Library has a lot of functions and classes like a definition for a string, arrays, tuples, functions for reading in and outputting files, random number generators, definitions for com

#include <iostream>

In general, <> directs the program to look for system headers in a specific folder. The double quotes """ tell the program to look for the header files in the same directory as the main.cpp file.

String

#include <string>

int main() {
   std::string stringvariable = "stringvalue";
   return 0;
}

Math

#include <iostream>
#include <cmath>

int main ()
{
   // calculate 
    std::cout << pow(3.4, 4);
}

Include Syntax

When you learned about structuring functions, you saw two different include statements:

#include <iostream>
#include "distance.h"

Other Useful Libraries

As previously mentioned, the C++ Standard Library generally comes with a C++ installation; however, there are many other useful C++ libraries that you install separately. Each library will have its own installation procedure and usually comes with instructions. Again, search engines are your best friends when trying to find and install libraries.

This link contains a list of many open source C++ libraries. In the list, you will see all kinds of libraries for math, gaming, computer vision, machine learning, as well as many other topics.

In the next lesson, you will learn to use the C++ vector library.

https://en.cppreference.com/w/cpp/links/libs

Last updated