#include using namespace std; struct Node { int Data; Node* next; } *rear, *front; void delQueue() { Node *temp, *var=rear; if(var==rear) { rear = rear->next; delete var; } else cout << endl << "Queue is Empty"; } void push(int value) { Node *temp = new Node; temp->Data=value; if (front == NULL) { front=temp; front->next=NULL; rear=front; } else { front->next=temp; front=temp; front->next=NULL; } } void display() { Node *var=rear; if(var!=NULL) { cout << endl << "Elements are: "; while(var!=NULL) { cout << var->Data << " "; var=var->next; } cout << endl; } else cout << "Queue is Empty"; } int main() { int i=0; front=NULL; cout << endl << " 1. Push to Queue"; cout << endl << " 2. Pop from Queue"; cout << endl << " 3. Display Data of Queue"; cout << endl << " 4. Exit" << endl; while(1) { cout << endl << " Choose Option: "; cin >> i; switch(i) { case 1: { int value; cout << endl << "Enter a value to push into Queue: "; cin >> value; push(value); display(); break; } case 2: { delQueue(); display(); break; } case 3: { display(); break; } case 4: { exit(0); } default: { cout << "Wrong choice..."; } } } }