Skip to content

Commit 5d7546f

Browse files
authored
Queue Operations In STL (#245)
1 parent ba5e6d0 commit 5d7546f

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

CPP/stl/Queue & Operations.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include<iostream>
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
5+
int main()
6+
{
7+
queue<int>q;
8+
q.push(4);
9+
q.push(5);
10+
q.push(6);
11+
q.push(7);
12+
13+
//remove 1st element from front
14+
q.pop();
15+
16+
//show the front or 1st element
17+
cout<<q.front()<<endl;
18+
19+
//show the last element
20+
cout<<q.back()<<endl;
21+
22+
//diplay the size of array
23+
cout<<q.size()<<endl;
24+
25+
//checking if queue is empty or not
26+
if (q.empty())
27+
{
28+
cout<<"Yes Empty"<<endl;
29+
}
30+
else
31+
{
32+
cout<<"No Not Empty"<<endl;
33+
}
34+
35+
return 0;
36+
}

0 commit comments

Comments
 (0)