Question: 2. The following program implements a store and retrieve structure which is a cross between a stack and a quue. The retrieve member function retrieves


2. The following program implements a store and retrieve structure which is a cross between a stack and a quue. The retrieve member function retrieves the last node stored (LIFO like a stack) provided the number of nodes stored is odd otherwise it retrieves the first node stored (FIFO like a queue) Write the member functions of the class stacq. Hint: ifx is odd then x % 2 will be 1 For marking purposes store 1, 2, 3, 4 then print to the file, retrieve and print retrieve and print // File: stacq.cpp // This program implements a cross betveen a stack and a queue #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
