using System;
using System.Collections;
namespace QueuesCode
{
class Program
{
static void Main(string[] args)
{
Queue line = new Queue();
line.Enqueue(1);
line.Enqueue(2);
line.Enqueue(3);
line.Enqueue(4);
line.Enqueue(5);
foreach(object o in line)
{
Console.WriteLine("The queue contains {0}",o);
}
Console.WriteLine("The queue contains 4: {0}",line.Contains(4));
line.Dequeue();
foreach (object o in line)
{
Console.WriteLine("The queue contains {0}", o);
}
Console.WriteLine("The Peek is {0}", line.Peek());
object[] myarr = line.ToArray();
Console.WriteLine(String.Join(",", myarr));
Console.ReadKey();
}
}
}
using System.Collections;
namespace QueuesCode
{
class Program
{
static void Main(string[] args)
{
Queue line = new Queue();
line.Enqueue(1);
line.Enqueue(2);
line.Enqueue(3);
line.Enqueue(4);
line.Enqueue(5);
foreach(object o in line)
{
Console.WriteLine("The queue contains {0}",o);
}
Console.WriteLine("The queue contains 4: {0}",line.Contains(4));
line.Dequeue();
foreach (object o in line)
{
Console.WriteLine("The queue contains {0}", o);
}
Console.WriteLine("The Peek is {0}", line.Peek());
object[] myarr = line.ToArray();
Console.WriteLine(String.Join(",", myarr));
Console.ReadKey();
}
}
}
Comments
Post a Comment