Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / 10-Practice-03.05.2022 / source.cpp
diff options
context:
space:
mode:
Commit169cbc9a9a36ef2d0c71d35bc2086a061982df95 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-03 21:04:38 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-03 21:04:38 +0300
Filesffa33cb5a21000ba48c9a8d0ec7f9fcbef1e9f2c /Year 1/Object-oriented Programming/10-Practice-03.05.2022/source.cpp
uni-projects-169cbc9a9a36ef2d0c71d35bc2086a061982df95.tar
uni-projects-169cbc9a9a36ef2d0c71d35bc2086a061982df95.tar.gz
uni-projects-169cbc9a9a36ef2d0c71d35bc2086a061982df95.zip
Parent28530b6cf63ea53bbb88e8d92ccfe452a0064882 (diff)
Finished todays practice
1 files changed, 29 insertions, 0 deletions
-rw-r--r--Year 1/Object-oriented Programming/10-Practice-03.05.2022/source.cpp29
diff --git a/Year 1/Object-oriented Programming/10-Practice-03.05.2022/source.cpp b/Year 1/Object-oriented Programming/10-Practice-03.05.2022/source.cpp
new file mode 100644
index 0000000..48807c0
--- /dev/null
+++ b/Year 1/Object-oriented Programming/10-Practice-03.05.2022/source.cpp
@@ -0,0 +1,29 @@
+#include "MergeSort.hpp"
+#include <iostream>
+
+class Num {
+ int n;
+
+public:
+ Num() : Num(0) {}
+ Num(unsigned n) {
+ this->n = n;
+ }
+ unsigned get_n() const { return n; }
+};
+
+bool operator<(const Num& n1, const Num& n2) {
+ return n1.get_n() < n2.get_n();
+}
+
+std::ostream& operator<<(std::ostream& ostr, const Num& num) {
+ return ostr << num.get_n();
+}
+
+int main() {
+ const unsigned size = 3;
+ Num arr[] = { 7, 2, 9 };
+ Num* sorted = mergeSort(arr, size);
+ for (int i = 0; i < size; i++)
+ std::cout << sorted[i] << " ";
+}