add more doc
This commit is contained in:
45
include/NR.h
Normal file
45
include/NR.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class NR {
|
||||
private:
|
||||
int m_Numerator;
|
||||
int m_Denominator; // has to be > 0, sign is carried by the numerator
|
||||
|
||||
public:
|
||||
NR();
|
||||
NR(int entier);
|
||||
NR(int numerator, int denominator); // check if denominator != 0
|
||||
|
||||
int GetNumerator() const;
|
||||
int GetDenominator() 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;
|
||||
bool operator>=(const NR& opNR) const;
|
||||
|
||||
NR operator+(const NR& opNR) const;
|
||||
NR operator-(const NR& opNR) const;
|
||||
NR operator*(const NR& opNR) const;
|
||||
NR operator/(const NR& opNR) const;
|
||||
|
||||
NR& operator+=(const NR& opNR);
|
||||
NR& operator-=(const NR& opNR);
|
||||
NR& operator*=(const NR& opNR);
|
||||
NR& operator/=(const NR& opNR);
|
||||
|
||||
void Invert();
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const NR& opNR);
|
||||
friend std::istream& operator>>(std::istream& os, NR& opNR);
|
||||
|
||||
private:
|
||||
void Reduce();
|
||||
};
|
||||
|
||||
int PGCD(int x, int y);
|
||||
Reference in New Issue
Block a user