//stk5.cpp, CopyLeft by tsaiwn@csie.nctu.edu.tw // g++ stk5.cpp ; ./a.out #include #include // 新寫法沒有 .h 但要記得如下列的 using namespace std; using namespace std; // 因為C++ class library被集合到命名空間 std:: int main( ) { stack 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; }