代碼圖
效果圖
代碼
static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入用戶名");
? ? ? ? ? ? string name = Console.ReadLine();
? ? ? ? ? ? Console.WriteLine("請(qǐng)輸入密碼");
? ? ? ? ? ? string mima = Console.ReadLine();
? ? ? ? ? ? if (name == "admin"&& mima == "888888")
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("登錄成功");
? ? ? ? ? ? }
? ? ? ? ? ? else if (name != "admin" && mima != "888888")
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("用戶名密碼錯(cuò)誤");
? ? ? ? ? ? }
? ? ? ? ? ? else if (name != "admin")
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("用戶名輸入錯(cuò)誤");
? ? ? ? ? ? }
? ? ? ? ? ? else if (mima !="888888")
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.WriteLine("密碼輸入錯(cuò)誤");
? ? ? ? ? ? }
? ? ? ? ? ? Console.ReadKey();
? ? ? ? }
? ? }
}