Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. namespace Calculations {
  6.     class Rational {
  7.     private:
  8.         int numerator;
  9.         int denominator;
  10.  
  11.         int gcm(int, int) const;
  12.         int lcm(int, int) const;
  13.  
  14.     public:
  15.         Rational(int ,int );
  16.  
  17.         Rational(int);
  18.  
  19.         friend ostream &operator<<(ostream &, const Rational &);
  20.  
  21.         friend istream &operator>>(istream &, Rational &);
  22.  
  23.         int getNumerator() const;
  24.  
  25.         int getDenominator() const;
  26.  
  27.         friend Rational operator+(const Rational &, const Rational &);
  28.  
  29.         friend Rational operator-(const Rational &, const Rational &);
  30.  
  31.         friend Rational operator*(const Rational &, const Rational &);
  32.  
  33.         friend Rational operator/(const Rational &, const Rational &);
  34.  
  35.         friend Rational operator-(const Rational &);
  36.  
  37.         friend Rational operator!(const Rational &);
  38.  
  39. //        friend double static_cast<double>(liczba_starego_typu)
  40.     };
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement