Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / Solutions Sem. 10 / ex2 / main.cpp
diff options
context:
space:
mode:
Commit2a8bf5b484ae5eb05bbaaeaf613089dc4a15f73a (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 11:29:29 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 11:29:29 +0300
Files861c90c8cfdacda2ed11ae5b5e92b30e734b27db /Year 1/Object-oriented Programming/Solutions Sem. 10/ex2/main.cpp
uni-projects-2a8bf5b484ae5eb05bbaaeaf613089dc4a15f73a.tar
uni-projects-2a8bf5b484ae5eb05bbaaeaf613089dc4a15f73a.tar.gz
uni-projects-2a8bf5b484ae5eb05bbaaeaf613089dc4a15f73a.zip
Parent169cbc9a9a36ef2d0c71d35bc2086a061982df95 (diff)
Solved dimitriev hw (sem 10, ex2)
1 files changed, 29 insertions, 0 deletions
-rw-r--r--Year 1/Object-oriented Programming/Solutions Sem. 10/ex2/main.cpp29
diff --git a/Year 1/Object-oriented Programming/Solutions Sem. 10/ex2/main.cpp b/Year 1/Object-oriented Programming/Solutions Sem. 10/ex2/main.cpp
new file mode 100644
index 0000000..1dbdc8e
--- /dev/null
+++ b/Year 1/Object-oriented Programming/Solutions Sem. 10/ex2/main.cpp
@@ -0,0 +1,29 @@
+#include "kPriorityQueue.hpp"
+#include <iostream>
+
+int main()
+{
+ kPriorityQueue<char> q(5); // 5 priorities - 0, 1, 2, 3 and 4
+
+ q.push('A',0); //adds A with lowest priority: 0
+ q.push('B',3);
+ q.push('C',2);
+ q.pop();
+ q.push('E',1);
+ q.push('D',2);
+ q.push('F',0);
+ q.push('G',3);
+ q.push('H',4);
+ q.pop();
+ q.push('I',1);
+ q.push('J',2);
+
+ //q.push('F', 5); //error! No such priority!
+
+ // GCDJEIAF
+ for (int i = 0; i < 8; i++)
+ {
+ std::cout << q.peek();
+ q.pop();
+ }
+}