//stk4STL.cpp,  @opyLeft by tsaiwn@csie.nctu.edu.tw
// g++ stk4STL.cpp -Wno-deprecated 
// 注意, 因用舊的 #include 方法(有.h), 編譯時會有警告!
// 但你可以如上寫 -Wno-deprecated 叫 compiler 別囉嗦:-)
// 本範例重點: 站在巨人的肩膀上: 使用 C++ STL Library 的 stack, 因為:
// .. 因為, 其實在 C++ Class library 已經有 stack (女共匪寫的:-),
//它是以 template (樣板) 方式定義; 使用上更為方便!
//但其函數名稱與用法與一般資料結構課本上講的稍有不同;
//例如, 一般課本 pop不是void function. 
// 又如是否空堆疊用 empty( ) 不是 isempty( )
// 因為C++ 的一些資料結構class來自HP公司的 STL (Standard Template Library),
//在更早時要 #include <stl.h> 才能使用 STL 裡面的 class.
//後來, STL在1999年正式被納入 C++ 類別程式庫中, 可#include 各自的 header即可
//
#include <iostream.h>
#include <stack.h>
int main( ){
   stack <int> x;    // STL 中的 stack 是 template
   x.push(880);
   x.push(770);
   x.push(53);
   while(!x.empty()){
      cout << x.top();  x.pop();
   }
   cout << endl;
   return 0;
}
/****
D:\test> path C:\Dev-Cpp\bin;%path%

D:\test > g++ stk4STL.cpp
In file included from c:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../includ
e/c++/3.4.2/backward/iostream.h:31,
                 from stk4STL.cpp:12:
c:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/backward/b
ackward_warning.h:32:2: warning: #warning This file includes at least one deprec
ated or antiquated header. Please consider using one of the 32 headers found in
section 17.4.1.2 of the C++ standard. Examples include substituting the <X> head
er for the <X.h> header for C++ includes, or <iostream> instead of the deprecate
d header <iostream.h>. To disable this warning use -Wno-deprecated.

D:\test> a.exe
53770880

D:\test> g++ stk4STL.cpp -Wno-deprecated
D:\test> a
53770880

*********************************/