> For the complete documentation index, see [llms.txt](https://dsa-cpp.gitbook.io/nafees/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dsa-cpp.gitbook.io/nafees/queue/whats-queue-and-implementation.md).

# What's Queue & Implementation?

The Queue class is a container adaptor that gives the programmer the functionality of a queue - specifically, a FIFO (first-in, first-out) data structure.

## [Referenc](https://en.cppreference.com/w/cpp/container/queue)

{% file src="/files/02joeO4h1N5pQDLsSzMX" %}

<details>

<summary>Implementation Using STL</summary>

```cpp
#include <iostream>
#include <queue>

using namespace std;

// Print the queue
void showq(queue<int> q)
{
	while (!q.empty()) {
		cout << '\t' << q.front();
		q.pop();
	}
	cout << '\n';
}

// Driver Code
int main()
{
	queue<int> q;
	q.push(10);
	q.push(20);
	q.push(30);

	cout << "The queue q is : ";
	showq(q);

	cout << "\nq.size() : " << q.size();
	cout << "\nq.front() : " << q.front();
	cout << "\nq.back() : " << q.back();

	cout << "\nq.pop() : ";
	q.pop();
	showq(q);

	return 0;
}
```

</details>
