Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / 10-Practice-03.05.2022 / source.cpp
blob: 48807c02d755d75ada8d31289242605c4093445d (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
25
26
27
28
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] << " ";
}