Created
April 16, 2016 13:33
-
-
Save tanvir002700/5be41469a2c705ff7bf25c01b8887298 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<queue> | |
#include<stdlib.h> | |
using namespace std; | |
int main() | |
{ | |
queue<int>Q; | |
for(int i=0;i<5;i++) | |
{ | |
int x=rand()%100; | |
cout<<"Insert "<<x<<endl; | |
Q.push(x); | |
} | |
cout<<"Q front element: "<<Q.front()<<endl; | |
Q.pop(); | |
cout<<"Q front after pop: "<<Q.front()<<endl; | |
cout<<"Queue size: "<<Q.size()<<endl; | |
while(!Q.empty())Q.pop(); | |
cout<<"Is queue empty: "<<Q.empty()<<endl; | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Insert 83 | |
Insert 86 | |
Insert 77 | |
Insert 15 | |
Insert 93 | |
Q front element: 83 | |
Q front after pop: 86 | |
Queue size: 4 | |
Is queue empty: 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment