#include#include int main() { std::queue > q; q.push(10); q.push(20); q.push(30); while (!q.empty()) { std::cout << q.front() << " "; q.pop(); } return 0; }
#includeThis example creates a std queue that uses std list as the underlying container. It then pushes integers 10, 20, and 30 into the queue and prints them in the order they are popped from the queue. The std queue is part of the C++ Standard Library.#include #include int main() { std::queue
> q; q.push(10); q.push(20); q.push(30); while (!q.empty()) { std::cout << q.front() << " "; q.pop(); } return 0; }