Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / 06-Practice-29.03.2022 / ex2 / Rational.h
diff options
context:
space:
mode:
Commit793100813b3c50a1f304904440366a7137ae0992 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-03-30 08:41:52 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-03-30 08:41:52 +0300
Files439f4bdbc12de1fe990bd9f061c6dca213e8e1b6 /Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex2/Rational.h
uni-projects-793100813b3c50a1f304904440366a7137ae0992.tar
uni-projects-793100813b3c50a1f304904440366a7137ae0992.tar.gz
uni-projects-793100813b3c50a1f304904440366a7137ae0992.zip
Parentc105f7db9b10861dd0bdeedb3ed4d1ebe2054b87 (diff)
Reworked yesterdays oop practice folder structure
1 files changed, 24 insertions, 0 deletions
-rw-r--r--Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex2/Rational.h24
diff --git a/Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex2/Rational.h b/Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex2/Rational.h
new file mode 100644
index 0000000..f95e520
--- /dev/null
+++ b/Year 1/Object-oriented Programming/06-Practice-29.03.2022/ex2/Rational.h
@@ -0,0 +1,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;
+};