# What's Queue & Implementation?

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

{% file src="<https://3848643327-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F07O01HTuDHqLK3IxhYPe%2Fuploads%2FvfUyDtjW0aZsq0ZedPPt%2FTypes%20of%20Queues.pdf?alt=media&token=a5808dfa-798f-4d16-b8ec-3bbdfea40e1e>" %}

<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>
