Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C + + Please answer two questions 1 . What output does the following algorithm produce? Queue que; que.enqueue ( 5 ) que.enqueue ( 4

C++ Please answer two questions
1. What output does the following algorithm produce?
Queue que;
que.enqueue(5)
que.enqueue(4)
que.enqueue(4)
que.dequeue(item)
que.dequeue(item)
que.enqueue(item)
while (!que.IsEmtpy())
{
que.dequeue(item)
cout << item <<;
}
2. What is the result by the following code:
Queue que;
item1=1;
item2=0;
item3=4;
que.enqueue(item2);
que.enqueue(item1);
que.enqueue(item1+ item3);
que.dequeue(item2);
que.enqueue(item3* item3);
que.enqueue(item2);
que.enqueue(item3);
que.dequeue(item1);
cout << item1<<<< item2<<<< item3;
while(!que.IsEmpty()))
{
que.dequeue(item1);
cout << item1;
}

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

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions