Program Of Queue in C++



#include<iostream>
#include<queue>
#include<conio.h>
using namespace std;
void main()
{
            queue<int> myq;
            cout<<"Members of Queue\n";
            for(int i=0;i<5;i++)
            {
           
            cout<<"\nQueue  "<<i<<endl;
            myq.push(i);
           
            }
            cout<<"\nsize of my Queue is  "<<myq.size()<<endl;
            cout<<"\nLast membor of my Queue is  "<<myq.back()<<endl;
            while(!myq.empty())
            {
           
                        cout<<"\nEnqueing members of Queue  "<<myq.front()<<endl;
                        myq.pop();
           
            }

getch();
}



No comments:

Post a Comment