// mymain3.cpp; g++ mymain3.cpp ; ./a.out #include "mystk3.h" //注意以下 iostream.h 為舊的寫法; 1999之後的 C++ 使用 #include using namespace std; // 新#include 的寫法要用到 namesapce std int main( ) { MyStack x; MyStack y; x.push(880); x.push(770); x.push(53); while(!x.empty()){ cout << x.top(); y.push( x.top() + 0.5 ); x.pop(); } cout << endl << "=== === now dump y:\n"; while(!y.empty()){ cout << y.top() << " "; y.pop(); } cout << "\n=== bye bye ===" << endl; return 0; // normal return }