Number of elements in queue is: 7 front is 8 back is 9 front is 9 back is 9 front is 3 back is 9 front is 3 back is 9 front is 8 back is 9 front is 4 back is 9 front is 9 back is 9 #include #include using namespace std; // empty(): Checks to see if the stack is empty. // pop(): Deletes the element from the front of the queue. // push(): Adds element to the back of the queue. // size(): Computes and returns the number of elements in the queue. // back(): Returns a reference to the last element added to the back of the queue. // front(): Returns a reference to the first element in the front of the queue. int main() { // Queues queue q; int f,b; q.push(8); q.push(9); q.push(3); q.push(3); q.push(8); q.push(4); q.push(9); cout << "Number of elements in queue is: " << q.size() << endl; while (! q.empty()) { f = q.front(); b = q.back(); cout << "front is " << f << " back is " << b << endl; q.pop(); } }