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 s, temp;

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);

}

}

};How do you fix this program class my Queue { public: stack

#include 4 using namespace std 6 class myQueue 8 public: stack s,temp; 10 11 void enqueue (int x) while (!s.empty) 13 14 15 16 17 18 19 20 21 int* as.pop): temp.push (a); Cannot initialize a variable of type 'int with an rvalue of type 'void temp.push(x); while temp.empty)) Cannot initialize a variable of type 'int' with an rvalue of type 'void' 23 24 25 26 int a = temppop ( ) ; s.push(a)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!