📄 c07p357b.txt
字号:
// ********************************************************// Implementation file QueueL.cpp for the ADT queue.// ADT list implementation.// ********************************************************#include "QueueL.h" // header fileQueue::Queue(){} // end default constructorQueue::Queue(const Queue& Q): aList(Q.aList){} // end copy constructorQueue::~Queue(){} // end destructorbool Queue::isEmpty() const{ return (aList.getLength() == 0);} // end isEmptyvoid Queue::enqueue(QueueItemType newItem) throw(QueueException){ try { aList.insert(aList.getLength()+1, newItem); } // end try catch (ListException e) { throw QueueException("QueueException: cannot enqueue item"); } // end catch} // end enqueuevoid Queue::dequeue() throw(QueueException){ if (aList.isEmpty()) throw QueueException("QueueException: empty queue, cannot dequeue"); else aList.remove(1);} // end dequeuevoid Queue::dequeue(QueueItemType& queueFront) throw(QueueException){ if (aList.isEmpty()) throw QueueException("QueueException: empty queue, cannot dequeue"); else { aList.retrieve(1, queueFront); aList.remove(1); } // end if} // end dequeuevoid Queue::getFront(QueueItemType& queueFront) const throw(QueueException){ if (!aList.isEmpty()) throw QueueException("QueueException: empty queue, cannot getFront"); else aList.retrieve(1, queueFront);} // end getFront// End of implementation file.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -