public static void Main(string[] args) { MyStack stack = new MyStack(); stack.push (1); stack.push (2); stack.push (3); stack.push (4); Console.WriteLine ("The top element is " + stack.topElement ()); Console.WriteLine ("The popped element is " + stack.pop ()); Console.WriteLine ("The popped element is " + stack.pop ()); Console.WriteLine ("The top element is " + stack.topElement ()); MyQueue queue = new MyQueue(); queue.enqueue (1); queue.enqueue (2); queue.enqueue (3); queue.enqueue (4); Console.WriteLine ("The dequeued element is " + queue.dequeue ()); Console.WriteLine ("The dequeued element is " + queue.dequeue ()); Console.Read(); }
public static void Main(string[] args) { MyStack stack = new MyStack(); stack.push(1); stack.push(2); stack.push(3); stack.push(4); Console.WriteLine("The top element is " + stack.topElement()); Console.WriteLine("The popped element is " + stack.pop()); Console.WriteLine("The popped element is " + stack.pop()); Console.WriteLine("The top element is " + stack.topElement()); MyQueue queue = new MyQueue(); queue.enqueue(1); queue.enqueue(2); queue.enqueue(3); queue.enqueue(4); Console.WriteLine("The dequeued element is " + queue.dequeue()); Console.WriteLine("The dequeued element is " + queue.dequeue()); Console.Read(); }