Build a Queue from a Vector
easyQuestion 487Write a function queue<int> toQueue(const vector<int>& v) that returns a new queue<int> containing the elements of v in the same order, so v[0] ends up at the front of the queue.
The first test builds a queue from {4, 8, 15}, drains it and prints the values separated by spaces (see Expected Output).
The second test passes an empty vector and prints the size of the returned queue: Size: 0
Do NOT write a main function.
Expected output
4 8 15 Size: 0
= newline. The output ends with a newline, so print one after the last line.
Hints2 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.