5.20 c#验证码练习
Posted 岁月静好123
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了5.20 c#验证码练习相关的知识,希望对你有一定的参考价值。
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication10 { class Program { static void Main(string[] args) { Random ran = new Random(); for (; ; ) { string aa = "", bb = ""; for (int l = 1; l <= 4; l++) { int b = ran.Next(36); string[] c = new string[36] {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q", "R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7" ,"8","9","0"}; aa = c[b]; bb += aa; } Console.WriteLine("验证码是:" + bb); Console.Write("请输入验证码"); string ma = Console.ReadLine(); ma = ma.ToUpper(); if (ma == bb) { Console.WriteLine("验证码输入正确"); break; } else { Console.WriteLine("输入有误请重新输入"); } Console.ReadLine(); } } } }
以上是关于5.20 c#验证码练习的主要内容,如果未能解决你的问题,请参考以下文章