Continued fraction/Arithmetic/Construct from rational number: Difference between revisions
Content added Content deleted
(added python) |
|||
Line 47: | Line 47: | ||
Nigel Galloway, February 9th., 2013. |
Nigel Galloway, February 9th., 2013. |
||
*/ |
*/ |
||
class r2cf : ContinuedFraction { |
class r2cf : public ContinuedFraction { |
||
private: int n1, n2; |
private: int n1, n2; |
||
public: |
public: |
||
r2cf(const int numerator, const int denominator) { |
r2cf(const int numerator, const int denominator): n1(numerator), n2(denominator){} |
||
n1 = numerator; n2 = denominator; |
|||
} |
|||
const int nextTerm() { |
const int nextTerm() { |
||
const int thisTerm = n1/n2; |
const int thisTerm = n1/n2; |