#include #include class Queue { public: // We need to add the appropriate special member functions here // It is also ok to add other function to this class void push(int value) { head = new Node {value, head}; } void pop() { if ( head == nullptr ) { throw std::runtime_error{"List Empty in pop()"}; } Node** last{&head}; while ((*last)->next != nullptr) { last = &(*last)->next; } delete *last; *last = nullptr; } int front() const { if ( head == nullptr ) { throw std::runtime_error{"List Empty in front()"}; } Node* last{head}; while ( last->next != nullptr ) { last = last->next; } return last->value; } bool empty() const { return head == nullptr; } private: struct Node { int value; Node* next; }; Node* head; };