www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/26/16:32:12

Message-Id: <3.0.2.32.19981126211844.006e329c@tex.lineanet.net>
X-Sender: delfo AT tex DOT lineanet DOT net
X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.2 (32)
Date: Thu, 26 Nov 1998 21:18:44 +0100
To: djgpp AT delorie DOT com
From: Stefano Del Furia <delfo AT tech-center DOT com>
Subject: priority_queue problem
In-Reply-To: <199811241815.SAA04183@remus.clara.net>
References: <KgN6VDA+gtW2EwDA AT dunvegan1 DOT demon DOT co DOT uk>
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

Dear friends,
i have tried to compile this simple program that i have found on Nelson's
STL book.


//
// PQUE0704.CPP
//
// This program is used in Chapter 7 to demonstrate
// the use of a priority queue.  I create a prioirity
// queue based on deque<char>, then place the contents
// of this file (PQUE0704.CPP) into the queue.  I pull
// the characters out one at a time to demonstrate
// the fact that they will be removed in sorted order.
//
// Note that I use greater<T> instead of the conventional
// less<T>, so that the queue stores items smallest
// first instead of largest first.
//

//
// Borland 4.x workarounds.
//
#define __MINMAX_DEFINED
#pragma option -vi-

#include <deque.h>
#include <stack.h>
#include <function.h>
#include <iostream.h>
#include <fstream.h>

main()
{
    priority_queue< deque<char>, greater<char> > a;
    ifstream infile( "pque0704.cpp" );

    while ( infile ) {
        char c;
        infile >> c;
        if ( c != '\n' && infile )
            a.push( c );
    }
    while ( !a.empty() ) {
        cout << a.top();
        a.pop();
    }
    cout << endl;
    return 1;
}

But there's a problem because i getting a lot of error.
I use last version of DJGPP on a windows 95 environment.
I have read on the mail archive a i have found some month ago other people
had found the same problem.
Why you don't correct this problem?
TIA

 >>mailed by                              ''~``
 Stefano Del Furia                       ( o o )
  __________________________________.oooO--(_)--Oooo._
 | ___/ / _/__ www.geocities.com/SiliconValley/3546/  |
 |/ _  / _(_-< Computer Science Department            |
 |\_,_/_//___/ delfo AT tech-center DOT com  .oooO           |
 |ITIS "E.FERMI" Bibbiena 52010 AR IT (   )   Oooo.   |
 |_____________________________________\ (____(   )___| 
 THEORY is when you know everything     \_)    ) /
        but nothing works.                    (_/
 PRACTICE is when everything works
        but you don't know why.
 Our aim is to join THEORY and PRACTICE:
 (-: NOTHING works and we don't know WHY :-)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019