Home
Install
Use
Develop
Support
News
Credits
hosted by
|
17 friend std::istream& operator >> (std::istream& in, Rational& r);
18 friend std::ostream& operator << (std::ostream& out, const Rational& r);
22 explicit Rational( int numerator = 0, unsigned denominator = 1);
25 bool operator == ( const Rational&) const;
26 bool operator != ( const Rational&) const;
28 const Rational& operator = ( int num);
29 bool operator == ( int num) const;
30 bool operator != ( int num) const;
32 int operator * ( int num) const;
34 double doubleValue( ) const;
38 int normalize ( int) const ;
42 int get_numerator () const {
46 unsigned get_denominator () const {
58 T operator * (T x, const Rational& q)
60 return (x * q.get_numerator()) / q.get_denominator();
64 T operator / (T x, const Rational& q)
66 return (x * q.get_denominator()) / q.get_numerator();
70 bool operator > ( const Rational& q, T x)
72 return q.get_numerator() > (x * q.get_denominator());
76 bool operator < ( const Rational& q, T x)
78 return q.get_numerator() < (x * q.get_denominator());
81 #endif // !defined(__Rational_h)
Represents a rational number. Definition: Rational.h:15
Generated using doxygen 1.8.17
|