Here is my priority queue.. I can't seem to get my enqueue and dequeue to work quite right. The enqueue will work to a certain extent but still isn't that great. Any suggestions?

Code:#include<iostream> using namespace std; const int MAX = 10; const int DUMMY_PRIORITY = 1000; class qNode { public: int num; // queue element int priority; // queue priority qNode(); ~qNode(); }; qNode::qNode() { num = 0; priority = DUMMY_PRIORITY; } qNode::~qNode() { } class queue { private: qNode q[MAX]; // queue node int size; // queue size public: queue(); ~queue(); bool isEmpty(); bool isFull(); void enqueue(int,int); int dequeue(); void show(); }; queue::queue() { size = 0; } queue::~queue() { } bool queue::isEmpty() { bool empty = false; if(size == 0) { empty = true; } return empty; } bool queue::isFull() { bool full = false; if(size == MAX) { full = true; } return full; } void queue::enqueue(int number, int priority) { bool placedElement = false; // determine whether or not the element was placed qNode tempNode1; qNode tempNode2; int temp = 0; /* if the queue is empty, just add the number to the front of the queue */ if (isEmpty()) { q[temp].num = number; q[temp].priority = priority; size++; placedElement = true; } else { while (!placedElement) { if(q[temp].priority > priority) { if(q[temp].priority != DUMMY_PRIORITY) { tempNode1 = q[temp]; q[temp].num = number; q[temp].priority = priority; size++; for(int i = temp + 1 ; i <= size ; i++) { // move the elements up tempNode2 = q[i]; q[i] = tempNode1; tempNode1 = tempNode2; } } else { q[temp].num = number; q[temp].priority = priority; size++; } placedElement = true; } else { temp++; } } } } int queue::dequeue() { int element = q[0].num; qNode tempNode1; qNode tempNode2; if(!isEmpty()) { size--; tempNode1 = q[size-1]; for(int i=size-1; i > 0; i--) { tempNode2 = q[i-1]; q[i-1] = tempNode1; tempNode1 = tempNode2; } } return element; } void queue::show() { for(int i=0; i<MAX; i++) { cout << "Element -> " << q[i].num << "\t" << "Priority -> " << q[i].priority << endl; } } int main() { int num; int priority; queue myQueue; for(int i=0; i<MAX; i++) { cout << "enter a number -> "; cin >> num; cout << "enter a priority -> "; cin >> priority; myQueue.enqueue(num,priority); cout << endl << endl; myQueue.show(); cout << endl << endl; } // dequeue 3 elements cout << "dequeuing " << myQueue.dequeue() << endl << endl; cout << "dequeuing " << myQueue.dequeue() << endl << endl; cout << "dequeuing " << myQueue.dequeue() << endl << endl; // myQueue.show(); return 0; }