Advertisement
jtentor

DemoStack1 - CS - Program

May 9th, 2020
1,266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 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 DemoStack1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("Demo de Stack");
  14.  
  15.             Stack miPila = new Stack();
  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.                 Console.WriteLine(miPila.Pop());
  27.             }
  28.             catch (Exception e)
  29.             {
  30.                 Console.WriteLine(e.Message);
  31.             }
  32.            
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement