c# while循环输入q跳出

通过while循环实现用户不停的输入名字,如果用户输入的q就跳出程序,用户输入次数最多为五次

题主要的代码如下

img

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = 0;
            while (count < 5)
            {
                var s = Console.ReadLine();
                if (s == "q") break;
                Console.WriteLine(s);
                count++;
            }
        }
    }
}

帮助麻烦点下【采纳该答案】,谢谢~~有其他问题可以继续交流~