Black-Scholes Option Pricing in C++

The Black-Scholes or Black-Scholes-Merton model is a financial mathematical equation for pricing options contracts and other derivatives. Fischer Black and Myron Scholes published the formula in their 1973 paper “The Pricing of Options and Corporate...

How to Iterate Over the Words of a String in C++

This tutorial will go through how to iterate over the words of a string consisting of multiple words. Table of contentsIterate Over Words using istringstreamIterate Over Words using for-loopIterate Over Words using strtokIterate Over Words using Boost LibrarySummary...

How to Sum the Elements of a Vector in C++

The simplest way to sum the elements of a vector is to use the accumulate function. This tutorial will describe the different ways to sum the elements of a vector with code examples. Table of contentsSum Elements of a Vector Using accumulateSum Elements of a Vector...

How to Iterate Through a Vector in C++

The simplest way to iterate through a vector using a for loop and the [] operator to index the vector. This tutorial will describe how to iterate through a vector with code examples. Table of contentsIterate Through a Vector Using IndexingIterate Through a Vector...

How to Sort a Vector in C++

You can sort a vector in C++ using the std::sort function. This tutorial will go through how to sort a vector in ascending and descending order. Table of contentsSort a Vector using std::sortSort a Vector in Descending Order using std::sortSummary Sort a Vector using...