See More

// Stack.cpp : ¶¨Òå¿ØÖÆÌ¨Ó¦ÓóÌÐòµÄÈë¿Úµã¡£ // #include "stdafx.h" #include #include"StackDemo.h" using namespace std; int main() { ArrStack arrS(5); //²åÈë cout << "arrS.Push(a):" << endl; arrS.Push(1); cout << " " << arrS.GetTop() << " "; arrS.Push(2); cout << " " << arrS.GetTop() << " "; arrS.Push(3); cout << " " << arrS.GetTop() << " " << endl; //ɾ³ý cout << "arrS.Pop():" << endl; arrS.Pop(); cout << " " << arrS.GetTop() << " "; arrS.Pop(); cout << " " << arrS.GetTop() << " "; try { arrS.Pop(); cout << " " << arrS.GetTop() << " " << endl; } catch (const std::exception& e) { cout << "Error: " << e.what() << endl; } //¿ÕÕ» cout << "arrS.IsEmpty(): " << arrS.IsEmpty() << " "; system("pause"); return 0; }