topical media & game development

talk show tell print

professional-program-22-FunctionObjects-QueueGreater.c

? / professional-program-22-FunctionObjects-QueueGreater.c


  include <queue>
  include <functional>
  include <iostream>
  using namespace std;
  
  int main(int argc, char** argv)
  {
    priority_queue<int, vector<int>, greater<int> > myQueue;
  
    myQueue.push(3);
    myQueue.push(4);
    myQueue.push(2);
    myQueue.push(1);
  
    while (!myQueue.empty()) {
      cout << myQueue.top() << endl;
      myQueue.pop();
    }
  
    return (0);
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.