|
Progression Library 0.0.1
A header only arithmetic, geometric and fibonacci progression library
|
A header only c++ progression library. More...
#include <progression.hpp>


Public Member Functions | |
| virtual long | first_value () |
| Resets the progression and returns the first value. | |
| virtual long | next_value ()=0 |
| Advances to and returns the next value in the progression. | |
| 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 | curr |
| Current value in the progression. | |
| long | first |
| First value of the progression. | |
A header only c++ progression library.
Basic Usage
Abstract base class representing a generic numeric progression.
This class defines the common interface for all progressions. It cannot be instantiated directly because next_value() is pure virtual. Derived classes must implement their specific way of advancing to the next term.
|
virtual |
Resets the progression and returns the first value.
This function is called at the beginning of print_progression() to ensure the sequence starts from the beginning.
Reimplemented in FibonacciPg.

|
pure virtual |
Advances to and returns the next value in the progression.
This is a pure virtual function – derived classes must provide their own implementation.
Implemented in ArithProgression, FibonacciPg, and GeometricProgression.

| void Progression::print_progression | ( | int | n | ) |
Prints the first n terms of the progression.
The output is space-separated on a single line followed by a newline.
| n | Number of terms to print (n ≥ 1). |
