|
Progression Library 0.0.1
A header only arithmetic, geometric and fibonacci progression library
|
Geometric progression: each term is obtained by multiplying by a fixed base. More...
#include <progression.hpp>


Public Member Functions | |
| GeometricProgression (long b=2) | |
| Constructs a geometric progression. | |
| long | next_value () override |
| Returns the next term in the geometric progression. | |
| Public Member Functions inherited from Progression | |
| virtual long | first_value () |
| Resets the progression and returns the first value. | |
| void | print_progression (int n) |
| Prints the first n terms of the progression. | |
| virtual | ~Progression ()=default |
| Virtual destructor to allow proper cleanup of derived objects. | |
Protected Attributes | |
| long | base |
| Fixed multiplier applied at each step. | |
| Protected Attributes inherited from Progression | |
| long | curr |
| Current value in the progression. | |
| long | first |
| First value of the progression. | |
Geometric progression: each term is obtained by multiplying by a fixed base.
| GeometricProgression::GeometricProgression | ( | long | b = 2 | ) |
Constructs a geometric progression.
Geometric Progression.
The first term is always 1.
| b | Multiplication factor (default = 2) |
|
overridevirtual |
Returns the next term in the geometric progression.
Multiplies the current value by the fixed base.
Implements Progression.