// mymain2.cpp -- by tsaiwn@csie.nctu.edu.tw // g++ mymain2.cpp mystk2.cpp ; ./a.out #include "mystk2.h" //注意以下 iostream.h 為舊的寫法; 1999之後的 C++ 使用 // 且要記得寫 using namespace std; #include int main( ) { MyStack x; // x is a Stack object x.push(880); x.push(770); x.push(53); while(!x.empty()){ cout << x.top(); x.pop(); } cout << endl; }