今天在外面看書 看到一個寫登陸的程序 可是沒有限制登陸的次數
想了一下 做了這個程序 簡單的來表示一下如何限制 登陸次數
using System;
namespace Ginger547
{
class Class1
{
public static void Main(string[] args)
{
int i = 3;
string strInput = null ;
for (i = 1 ; i<= 3 ; i++)
{
Console.WriteLine ("輸入密碼");
strInput = Console.ReadLine();
if (strInput =="Ginger547")
break;
else
Console.WriteLine("密碼錯誤,無法進入");
Console.WriteLine();
}
if (strInput == "Ginger547")
Console.WriteLine("Login 成功");
else
Console.WriteLine("非法進入.......");
Console.ReadLine();
}
}
}
|