一个叫号机程序C#,不知道函数怎么写对C#不是很懂

using System.Text;

namespace QueueMachine
{

//设计一个叫号机程序,输入1表示有人进队,输入2表示有人离开队列接受服务,3表示列出队列的成员和成员数目,0表示退出程序。
//已给定主程序,要求将三个函数补充完整
class Program
{

    static void addQueue(Queue q)
    {
        //要求输入一个名字,将此人加入到队列中
    
    }

    static void leaveQueue(Queue q)
    {
        //要求从队列中出来一个人,比如接受服务

    }


    static void listQueue(Queue q)
    {
        //输出队列中一共有多少人,并输出每个人名字
    }


    static void Main(string[] args)
    {
        int i=0;
        Queue q = new Queue(50);

        Console.WriteLine("This is a queue machine."+
            "You can type the following digits: \n"+
            "\t1 for entering the queue, \n"+
            "\t2 for leaving the queue, \n"+
            "\t3 for listing the members in the queue,\n"+
            "\t0 for exiting:");
        do
        {
            i = Convert.ToInt32(Console.ReadLine());
            if (i == 1)
            {
                addQueue(q);
            }
            else if (i == 2)
            {
                leaveQueue(q);
            }
            else if (i == 3)
            {
                listQueue(q);
            }
            else if(i==0)
            {
                 break;
            }
            else 
                Console.WriteLine("wrong input");

        } while (true);

这样?有帮助麻烦点个采纳【本回答右上角】,谢谢~~有其他问题可以继续交流~

img

using System;
using System.Text;
using System.Collections;
namespace QueueMachine
{
    //设计一个叫号机程序,输入1表示有人进队,输入2表示有人离开队列接受服务,3表示列出队列的成员和成员数目,0表示退出程序。
    //已给定主程序,要求将三个函数补充完整
    class Program
    {
        static void addQueue(Queue q)
        {
            //要求输入一个名字,将此人加入到队列中
            Console.Write("请输入姓名:");
            var s = Console.ReadLine();
            q.Enqueue(s);
            Console.WriteLine(s + "加入队列成功");
        }
        static void leaveQueue(Queue q)
        {
            //要求从队列中出来一个人,比如接受服务
            var s = q.Dequeue();
            Console.WriteLine(s + "=》接受服务");
        }

        static void listQueue(Queue q)
        {
            //输出队列中一共有多少人,并输出每个人名字
            foreach (var s in q) Console.WriteLine(s);
        }

        static void Main(string[] args)
        {
            int i = 0;
            Queue q = new Queue(50);
            Console.WriteLine("This is a queue machine." +
                "You can type the following digits: \n" +
                "\t1 for entering the queue, \n" +
                "\t2 for leaving the queue, \n" +
                "\t3 for listing the members in the queue,\n" +
                "\t0 for exiting:");
            do
            {
                i = Convert.ToInt32(Console.ReadLine());
                if (i == 1)
                {
                    addQueue(q);
                }
                else if (i == 2)
                {
                    leaveQueue(q);
                }
                else if (i == 3)
                {
                    listQueue(q);
                }
                else if (i == 0)
                {
                    break;
                }
                else
                    Console.WriteLine("wrong input");
            } while (true);
        }
    }
}