Mail Archives: djgpp/1998/11/26/16:32:12
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 -