Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

}

}

};image text in transcribed

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

Students also viewed these Databases questions

Question

1. Identify what positions are included in the plan.

Answered: 1 week ago

Question

2. Identify the employees who are included in the plan.

Answered: 1 week ago