Пример #1
0
 private void readNode(Stack_Node r)
 {
     Console.WriteLine("--------------");
     Console.WriteLine("Name : {0}", r.Name);
     Console.WriteLine("Value : {0}", r.Value);
     Console.WriteLine("--------------");
 }
Пример #2
0
        public void print()
        {
            Stack_Node p = stackNode;

            while (p != null)
            {
                readNode(p);
                p = p.Prev;
            }
        }
Пример #3
0
 public void pop()
 {
     if (stackNode != null)
     {
         Stack_Node p = stackNode;
         readNode(p);
         stackNode = stackNode.Prev;
         p.Prev    = null;
         p         = null;
     }
     else
     {
         Console.WriteLine("There is nothing on the stack");
     }
 }
Пример #4
0
        public void push(string name, int value)
        {
            Stack_Node n = new Stack_Node();

            n.Name  = name;
            n.Value = value;
            if (stackNode != null)
            {
                n.Prev    = stackNode;
                stackNode = n;
            }
            else
            {
                stackNode      = n;
                stackNode.Prev = null;
            }
        }
Пример #5
0
 public StackClass()
 {
     stackNode = null;
 }