Advertisement
backlog

queue-----00001

Feb 3rd, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. void show(queue <string> qt)
  5. {
  6.     while(!qt.empty())
  7.     {
  8.         cout<<qt.front()<<endl;
  9.         qt.pop();
  10.     }
  11. }
  12.  
  13.  
  14.  
  15. void show(queue <int> qt)
  16. {
  17.     while(!qt.empty())
  18.     {
  19.         cout<<qt.front()<<endl;
  20.         qt.pop();
  21.     }
  22. }
  23.  
  24.  
  25.  
  26. int main()
  27. {
  28.  queue <string> q;
  29.  
  30.  
  31.  q.push("ashraful");
  32.  q.push("alam");
  33.  q.push("giash");
  34.  
  35.  cout<<q.size() <<endl;
  36.  cout<<q.front()<<endl;
  37.  cout<<q.back();
  38.  cout<<endl;
  39.  cout<<q.empty();
  40. cout<<endl;
  41.  //q.pop();
  42.  cout<<q.front();
  43.  
  44.  
  45.  cout<<endl;
  46.  cout<<endl;cout<<endl;
  47.   show(q);
  48.    cout<<endl;
  49.  cout<<endl;cout<<endl;
  50.  
  51.  
  52.  queue <int> q1;
  53.  for(int i=0;i<10; i++)
  54.     q1.push(i);
  55.  
  56.   show(q1);
  57.  return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement