queue.front() : queue « Queue Stack « C++






queue.front()

   
 

#include <iostream>
using std::cout;
using std::endl;

#include <queue>

int main()
{
   std::queue< double > values;
   
   values.push( 3.2 );
   values.push( 9.8 );
   values.push( 5.4 );

   cout << "Popping from values: ";
   
   while ( !values.empty() ) 
   {
      cout << values.front() << ' ';
      values.pop();
   }

   cout << endl;
   return 0;
}

 /* 
Popping from values: 3.2 9.8 5.4

 */       
    
    
  








Related examples in the same category

1.queue with doubles
2.queue: push, pop, front and size
3.Queue: push, pop and size
4.Queue of string: push(), empty(), front(), pop()
5.Put string into a queue