WIP
This commit is contained in:
parent
69874ba9f4
commit
7979b31d9b
1 changed files with 12 additions and 0 deletions
12
fraction.cpp
12
fraction.cpp
|
@ -35,6 +35,18 @@ namespace FractionNS {
|
||||||
this->m_numerator = numerator / gcd;
|
this->m_numerator = numerator / gcd;
|
||||||
this->m_denominator = denominator / gcd;
|
this->m_denominator = denominator / gcd;
|
||||||
}
|
}
|
||||||
|
Fraction::Fraction(int n) {
|
||||||
|
this->m_numerator = n;
|
||||||
|
this->m_denominator = 1;
|
||||||
|
}
|
||||||
|
Fraction::Fraction(float n) {
|
||||||
|
// TODO
|
||||||
|
throw std::runtime_error("Not yet implemented");
|
||||||
|
}
|
||||||
|
Fraction::Fraction(const Fraction& n) {
|
||||||
|
this->m_numerator = n.getNumerator();
|
||||||
|
this->m_denominator = n.getDenominator();
|
||||||
|
}
|
||||||
|
|
||||||
int Fraction::getNumerator() const { return m_numerator; }
|
int Fraction::getNumerator() const { return m_numerator; }
|
||||||
int Fraction::getDenominator() const { return m_denominator; }
|
int Fraction::getDenominator() const { return m_denominator; }
|
||||||
|
|
Reference in a new issue