用户名登入界面的创建

              

  Console.Write("请输入您的用户名:");
                string strname = Console.ReadLine();
                Console.Write("请输入您的密码:");
                string key = Console.ReadLine();
                bool acc = (strname=="kangshuai" && key== "123");
                string act=acc?"登入成功":"登入失败";
                Console.WriteLine(act);
                Console.ReadLine();

            string name = "";//声明变量,赋值为空
            string key = "";
            while ((name != "kangshuai") && (key !=" 123"))//两个空变量均满足条件,即进入循环体内。
            {
                Console.WriteLine("请输入您的用户名:");
                name = Console.ReadLine();
                Console.WriteLine("请输入您的密码:");
                key = Console.ReadLine();
            }
            Console.WriteLine("登入成功");
            Console.ReadLine();
原文地址:https://www.cnblogs.com/kangshuai/p/4541963.html