Queue: push and pop : Queue « Data Structure « C++






Queue: push and pop

Queue: push and pop
#include <iostream>
#include <string>
#include <queue>
using namespace std;

int main()
{
    queue<string> queueObject;

    queueObject.push( "www." );
    queueObject.push( "java." );
    queueObject.push( "com" );

    while ( !queueObject.empty() ) {
        cout << queueObject.front() << " ";
        queueObject.pop();
     }

     return 0;
}

           
       








Related examples in the same category

1.Demonstrate the queue class: push, front, empty and popDemonstrate the queue class: push, front, empty and pop
2.Cycling through a queue.Cycling through a queue.
3.Define our own Queue classDefine our own Queue class
4.Define a queueDefine a queue
5.Your own Queue classYour own Queue class