C++ Tutorial #3 — Order of operations, Simple interest, compounding interest


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:

  1. Parenthesis
  2. Multiplication and Division
  3. Addition and subtraction.
  4. “Left to right”


Cmath library
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: pow(double, int);

Leave a Reply

Your email address will not be published. Required fields are marked *

*