(while)要求用户输入帐号、密码,只要不是admin和888就一直提示要求重新输入

using System;
using System.Collections.Generic;
using System.Text;

namespace while判断用户名密码
{
    class Program
    {
        static void Main(string[] args)
        {
          bool count = true;
            while (count)
            {
                Console.WriteLine("请输入帐号");
                string username = Console.ReadLine();
                Console.WriteLine("请输入密码");
                string password = Console.ReadLine();
                if (username == "admin" && password == "888")
                {
                    count = false;
                }
                else
                {
                    count = true;
                }
            }
            Console.WriteLine("欢迎使用本系统");


            Console.ReadKey();
        }
    }
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章