logo CodeStepByStep logo

queueMystery1

Language/Type: C++ stack collections STL

What is the output of the following code?

queue queue;
for (int i = 1; i <= 6; i++) {
    queue.push(i);
}                             // {1, 2, 3, 4, 5, 6}

for (int i = 0; i < queue.size(); i++) {
    cout << queue.pop() << " ";
}
cout << queue << "  size " << queue.size() << endl;
output

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.