how to print values in queue C++ code example
Example: print queue c++
#include <queue>
#include <iostream>
void print_queue(std::queue q)
{
while (!q.empty())
{
std::cout << q.front() << " ";
q.pop();
}
std::cout << std::endl;
}
int main()
{
std::queue<int> q;
for (auto i : {1,2,3,7,4,9,7,2,4}) q.push(i);
print_queue(q);
}