using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication33
{
class Program
{
static void Main(string[] args)
{
Queue<string> li = new Queue<string>();
li.Enqueue("ali");
li.Enqueue("ahmed");
li.Enqueue("ahsan");
li.Enqueue("asim");
Console.WriteLine("top element : "+li.Peek());
foreach (var item in li)
{
Console.WriteLine(item);
}
Console.WriteLine("Press any key to dequeue...");
Console.ReadLine();
li.Dequeue();
Console.WriteLine("top element : " + li.Peek());
foreach (var item in li)
{
Console.WriteLine(item);
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment