Mail Archives: djgpp/2000/07/07/19:32:11
On Fri, 7 Jul 2000 15:43:18 +0200, "Petr Maxa" <maxa AT sse-za DOT sk> wrote:
>Hi Nimrod,
>thanks for the source, I've compiled as You recomended, but got the same
>errors (see in atachment).
>
>Everythink works right when I change
>stack<deque<int> > s;
>for
>stack<int> s;,
>but I am not sure if it is the same.
>I do not have access to any other compiler which support stl, so I ask in
>this group.
>
I'm not sure what you mean by the same. This sample looks like it
simply tries to demonstrate the stack type. If that's the prupose of
the demo then yes it's pretty much the same. If the purpose was to
demonstate a stack of deques holding int's then it's not the same. For
what it's worth, this code compiles and runs on several compilers
(including gcc and vc) just fine here.
#include <iostream>
#include <stack>
int main (int argc, char **argv)
{
stack<int> s;
s.push (42);
s.push (101);
s.push (69);
s.push (200);
while (!s.empty ())
{
cout << s.top () << endl;
s.pop ();
}
return 0;
}
Hope this in some way helped. I would suggest you read up on stacks
and deques. Then write some simple programs to play around with both
types yourself and then you'll be headed in the productive direction.
- Raw text -