string ss = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
Random a = new Random();
int b;
string yan = "";
for (int i = 0; i < 4; i++)
{
b = a.Next(62);
yan += ss.Substring(b, 1);
}
Console.WriteLine("驗證碼是:" + yan);
Console.Write("請輸入驗證碼:");
string c = Console.ReadLine();
if (c.ToUpper() == yan.ToUpper())
{
Console.WriteLine("驗證碼正確!");
}
else
{
Console.WriteLine("驗證碼錯誤!");
}
Console.ReadLine();