-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue.cpp
More file actions
44 lines (31 loc) · 719 Bytes
/
Copy pathqueue.cpp
File metadata and controls
44 lines (31 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<iostream>
#include<queue>
using namespace std;
void showq(queue<string> gq)
{
cout<<"\n queue elements are : ";
queue<string> g = gq;
while (!g.empty()) {
cout << '\t' << g.front();
g.pop();
}
cout << '\n';
}
int main()
{
queue<string> q;
q.push("heyy");
q.push("i");
q.push("love");
q.push("programming");
showq(q);
cout<<"size before pop : "<<q.size()<<endl;
cout<<"First element before pop: "<<q.front()<<endl;
cout<<"Last element before pop: "<<q.back()<<endl;
q.pop();
cout<<"size after pop : "<<q.size()<<endl;
cout<<"First element after pop: "<<q.front()<<endl;
cout<<"Last element after pop: "<<q.back()<<endl;
showq(q);
return 0;
}