#pragma once #include class NR { private: int m_Numerator; int m_Denominator; //has to be > 0, sign is carried by the numerator public: NR() : m_Numerator(0), m_Denominator(1) {} NR(int entier) : m_Numerator(entier), m_Denominator(1) {} NR(int numerator, int denominator); //check if denominator != 0 void NRset(int numerator, int denominator); //same void reduceNR(); //divide by PGCD, not automatically called yet void invertNR(); int NRgetNum() const; int NRgetDen() const; NR& operator =(const NR& opNR); bool operator ==(const NR& opNR) const; bool operator <(const NR& opNR) const; bool operator >(const NR& opNR) const; bool operator !=(const NR& opNR) const; bool operator <=(const NR& opNR) const; bool operator >=(const NR& opNR) const; friend std::ostream& operator <<(std::ostream& os, const NR& opNR); friend std::istream& operator >>(std::istream& os, NR& opNR); NR operator +(const NR& opNR) const; NR operator -(const NR& opNR) const; NR operator *(const NR& opNR) const; NR operator /(const NR& opNR) const; static void test(); }; int PGCD(int x, int y);