Question: How do you fix this program class my Queue { public: stack s, temp; void enqueue(int x) { while (!s.empty()) { int* a = s.pop();
How do you fix this program
class my Queue
{
public:
stack
void enqueue(int x)
{
while (!s.empty())
{
int* a = s.pop();
temp.push(a);
}
temp.push(x);
while (!temp.empty())
{
int a = temp.pop();
s.push(a);
}
}
};
#include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
