Code

#include
#include
using namespace std;

int main()
{
 queue q;

 cout << "Queue size :: " << q.size() << endl;
 
 for(int i=1; i<=5; i++)
  q.push(i);
 
 cout << "Queue size :: " << q.size() << endl;

 cout << "Elements into queue :: " << endl;
 while(!q.empty())
 {
  cout << q.front() << endl;
  q.pop();
 }

 if(q.empty())
  cout << "Queue is empty..." << endl;
 else
  cout << "Not empty..." << endl;

 return 0;
}

Output

Queue size :: 0
Queue size :: 5
Elements into queue :: 
1
2
3
4
5
Queue is empty

0 comments:

Post a Comment

About this blog

Hi! I'm Md Fasihul Kabir Rafi from Bangladesh, studying in Ahsanullah University of Science & Technology in Computer Science & Engineering Department. This is my personal blog. I want to share my experince (Though I don't know anything) with all of you.

I will constantly gonna post lost of helpful and interesting things for you. So please keep visiting my blog and also visite my website. If you want to email me then mail me at the following mail address, I will get touch with you ASAP.

Website : www.aboutrafi.net23.net

Email : blog@aboutrafi.net23.net