Ejemplo n.º 1
0
        private void btPush_Click(object sender, EventArgs e)
        {
            int Value = Convert.ToInt32(tbValor.Text);

            p.push(Value);
            tbValor.Text = null;
            tbValor.Focus();
        }
Ejemplo n.º 2
0
 public void popNumber(int a)
 {
     if (!isEmpty())
     {
         Pilha p      = new Pilha();
         int   verify = 0;
         while (verify != a)
         {
             if (topo.Data == a)
             {
                 pop();
                 verify = a;
             }
             else
             {
                 p.push(topo.Data);
                 topo = topo.Next;
             }
         }
         while (p.topo != null)
         {
             push(p.topo.Data);
             p.topo = p.topo.Next;
         }
     }
 }
Ejemplo n.º 3
0
        public Pilha inverte()
        {
            Pilha a = new Pilha();

            if (!isEmpty())
            {
                NohPilha temp = topo;
                while (temp != null)
                {
                    a.push(temp.Data);
                    temp = temp.Next;
                }
                a.print();
            }
            return(a);
        }