Advertisement
jtentor

DemoStack3 - CS - Program

May 11th, 2020
1,364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace DemoStack3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("Demo de Stack");
  14.  
  15.             Stack<char> miPila = new Stack<char>();
  16.  
  17.             miPila.Push('a');
  18.             miPila.Push('b');
  19.             miPila.Push('c');
  20.  
  21.             Console.WriteLine(miPila.Pop());
  22.             Console.WriteLine(miPila.Pop());
  23.             Console.WriteLine(miPila.Pop());
  24.  
  25.             try
  26.             {
  27.                 Console.WriteLine(miPila.Pop());
  28.             }
  29.             catch (Exception e)
  30.             {
  31.                 Console.WriteLine(e.Message);
  32.             }
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement