static void PrintStackList(StackList <int> s, string text = "输出:") { int data = 0; int length = s.GetLength(); Console.Write(text); for (int i = 0; i < length; i++) { s.Pop(ref data); Console.Write(data.ToString() + " "); } Console.WriteLine(); }
static void TestStackList() { //进栈测试 StackList <int> s = new StackList <int>(); PrintStackList(s, "进栈前:"); s.Push(5); s.Push(20); s.Push(33); PrintStackList(s, "依次进栈5,20,33后依次出栈:"); Console.WriteLine(s.isEmpty()); Console.WriteLine(); //清空栈 s.Push(99); s.Push(88); s.Push(22); s.ClearStack(); PrintStackList(s, "清空栈后:"); }
public Calculator() { _elements = new MyList <string>(100); _midStack = new StackList <string>(100); _laterString = new MyList <string>(100); }