jtentor icon

DemoStack3 - CS - Program

jtentor | PRO | 05/11/20 08:55:36 PM UTC | 0 ⭐ | 1619 👁️ | Never ⏰ | []
C# |

780 B

|

None

|

0 👍

/

0 👎

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace DemoStack3
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Demo de Stack");
 
            Stack<char> miPila = new Stack<char>();
 
            miPila.Push('a');
            miPila.Push('b');
            miPila.Push('c');
 
            Console.WriteLine(miPila.Pop());
            Console.WriteLine(miPila.Pop());
            Console.WriteLine(miPila.Pop());
 
            try
            {
                Console.WriteLine(miPila.Pop());
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}

Comments