Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / 05-Practice-29.03.2022 / ex2-Rational.h
blob: f95e520d9e1d39f7e58740df38efd9eaf21544a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Rational {
	int numerator;
	int denumerator;

public:
	Rational(int numerator, int denumerator);

	int get_numerator() const;
	void set_numerator(int numerator);

	int get_denumerator() const;
	void set_denumerator(int denumerator);

	void canonize();

	Rational operator+(const Rational& other);
	Rational operator-(const Rational& other);
	Rational operator*(const Rational& other);
	Rational operator/(const Rational& other);

	int numcmp(const Rational& arg) const;

	void print() const;
};