Question: For this machine problem you are to write a stack class and a queue class. Both are to be implementd by a circular doubly linked
For this machine problem you are to write a stack class and a queue class.
Both are to be implementd by a circular doubly linked list.
In addition, your program should be written by suppling he missing class
methods. No changes to the given code are allowed. In each case the test
data is built into the program.
Here is the stack.
#include
#include
using namespace std;
class stack
private:
struct dlink
char value;
dlink prev, next;
base;
public:
stack;
bool isempty;
char pop;
void pushchar;
char top;
;
missing class methods go here.
int main
stack stk;
stkpusha;
stkpushb;
stkpushc;
stkpushd;
whilestkisempty
cout stktop
;
cout stkpop
;
cout
;
And here is the queue.
#include
#include
using namespace std;
class queue
private:
struct dlink
char value;
dlink prev, next;
base;
public:
queue;
bool isempty;
char dequeue;
void enqueuechar;
;
missing class methods go here.
int main
queue que;
que.enqueuea;
que.enqueueb;
que.enqueuec;
que.enqueued;
whileque.isempty
cout que.dequeue
;
cout
;
can u do write stack class and a queue class different code. so one code in stack class and one code in queue class.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
