public static void Main(string[] args) { QueueUsingStack que = new QueueUsingStack(); que.add(1); que.add(2); que.add(3); for (int i = 0; i < 3; i++) { Console.WriteLine(q.remove()); } }
public static void Main(string[] args) { QueueUsingStack que = new QueueUsingStack(); que.add(1); que.add(11); que.add(111); Console.WriteLine(que.remove()); que.add(2); que.add(21); que.add(211); Console.WriteLine(que.remove()); Console.WriteLine(que.remove()); Console.WriteLine(que.remove()); Console.WriteLine(que.remove()); Console.WriteLine(que.remove()); }
private static void QueueUsingStackExercise() { try { QueueUsingStack stack = new QueueUsingStack(); stack.Enqueue(10); stack.Enqueue(20); stack.Enqueue(30); Console.WriteLine(stack.Dequeue()); Console.WriteLine(stack.Dequeue()); Console.WriteLine(stack.Dequeue()); stack.Enqueue(40); Console.WriteLine(stack.Dequeue()); } catch (Exception ex) { Console.WriteLine(ex.Message); } }