Topics covered: Order of operations in C++, simple interest formula / calculation, compounding interest formula calculation
Source code: Source Code Available Here
Order of operations
In C++, there is an order of operations, much like the one that we see in traditional mathematics. In C++, the order of operations is as follows:
- Multiplication and Division
- Addition and subtraction.
- “Left to right”
The Cmath library contains a lot of useful things, for instance square root (sqrt) floating point modulo (fmod / fmodf) and more. In this case we are using ‘pow’ which is used like this: