Queue 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374#include <iostream>using namespace std;template <class T>class Node {private: T data; Node* next;public: Node(T d) : data(d) { next = NULL; } T getData() { return data; } Node* getNext() { return next; } void setNext(Node* n) { next = n; return; }};template <class T>class Queue {public: Node<T> *Head; Node<T> *Tail; Node<T> *cur; int size;public: Queue(T d) { size = 1; Head = new Node(d); Tail = Head; } Queue() { size = 0; Head = NULL; Tail = NULL; } void pop() { cur = Head->getNext(); free(Head); Head = cur; size--; } void push(T d) { if (size==0) { Head = new Node<T>(d); Tail = Head; } else { cur = Tail; Tail = new Node<T>(d); cur->setNext(Tail); } size++; } T front() { return Head->getData(); }};int main(int argc, char** argv) { Queue<int> q; for (int i = 0; i < 13; i++) { q.push(i); } for (int i = 0; i < 13; i++) { cout << q.front() << endl; q.pop(); } return 0;}