From 2a8bf5b484ae5eb05bbaaeaf613089dc4a15f73a Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 5 May 2022 11:29:29 +0300 Subject: Solved dimitriev hw (sem 10, ex2) --- .../Solutions Sem. 10/ex2/main.cpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Year 1/Object-oriented Programming/Solutions Sem. 10/ex2/main.cpp (limited to 'Year 1/Object-oriented Programming/Solutions Sem. 10/ex2/main.cpp') 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 + +int main() +{ + kPriorityQueue 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(); + } +} -- cgit v1.3.1-23-gd82d