← Back to STL Containers
Question 481
Queue Status
Queue Status
Write a function string status(const queue<int>& q) that returns the string "empty" if the queue has no elements, and "not empty" otherwise.
The tests print the returned string on its own line. For a queue holding 1, 2, 3 the output is exactly what is shown in Expected Output.
For a queue with nothing in it the output is:
empty
Do NOT write a main function.Expected Output:
not empty empty
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
STL ContainersQueues
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.