PriorityQueueOps.cc


int main()
{
    priority_queue< pair< string, unsigned int >, 
        vector <pair< string, unsigned int > >, Prioritize >   pq;   

    pq.push( pair<string, int>( "go to lunch", 2) );
    pq.push( pair<string, int>( "go to bathroom", 10 ) );
    pq.push( pair<string, int>( "take a nap", 1 ) );

    while ( !pq.empty() ) {                                       //(A)
        cout << pq.top().first << endl;
        pq.pop();
    }

    return 0;
}


Results

C:\classes\ece538\work\kak05>PriorityQueueOps
go to bathroom
go to lunch
take a nap


Maintained by John Loomis, updated Sun Jan 07 14:16:12 2007