Create a priority queue class calle priQueue that is derived from the vector class. Your class should be constructed as a template class so that the type of data the queue operates on can easily be changed:
iQueue; // holds ints
sQueue; // holds string.
Your priority queue should be sorted by priority based on a value from 1 to 10. If a number is assigned that is outside the range of 1 to 10 you should give the element a value of 5. What this means is that each time an element is added to the queue it should be put in order by priority. If multiple elements are given the same priority their position relative to each other is unimportant as long as they are prioritized relative to other elements in the queue.
Your priQueue should have the following functionallity:
You should create a struct called qElem that will hold both the priority of the element and the data to be put in the queue. The struct should also be of template type so that the value it holds can be of any type. The priority variable type should be an int.
The priQueue class should be derived from vector and should also be a template class so that it can operate on any type. The enque function should be adding a qElem struct so that the data and the prority are coupled. This needs to be done so that the data and priority are related for sorting. Here is an example:
que.enqueue("Goodbye", 9); // You are passing a string an an int but you should store a qElem
string s = que.dequeue();
The string s at this point should hold "Goodbye" even though it was put in last because it has a higher priority.
Sorting your queue. You are to create your own sort functionality. Pick any sort that you would like but the bubble sort might be the easiest to implement.
NOTE: Your priQueue class should be derived from the vector class that is part of the std namespace.