MarchThree
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Queue
{
    class Program
    {
        public static void PrintValue(IEnumerable<Int32> c)
        {
            IEnumerator<Int32> cEnumerator = c.GetEnumerator();
            while (cEnumerator.MoveNext())
            {
                Console.Write(cEnumerator.Current+" ");
            }
            Console.WriteLine();
        }

        static void Main(string[] args)
        {
            Queue<Int32> intQ = new Queue<int>();

            for (int i = 0; i < 5; i++)
            {
                intQ.Enqueue(i * 5);
            }

            //display queue
            PrintValue(intQ);

            //delete one member form the queue
            intQ.Dequeue();
            PrintValue(intQ);

            //view the first member
            Console.WriteLine(intQ.Peek());

            Console.ReadLine();


        }

    }
}


分类:

技术点:

相关文章:

  • 2021-09-20
  • 2021-06-03
  • 2021-08-24
  • 2021-05-18
  • 2021-09-29
  • 2021-06-30
  • 2021-05-27
  • 2021-10-11
猜你喜欢
  • 2021-07-25
  • 2022-12-23
  • 2021-10-05
  • 2022-12-23
  • 2021-07-23
  • 2022-02-25
  • 2021-12-07
相关资源
相似解决方案