码迷,mamicode.com
首页 > Windows程序 > 详细

C#解决验证码问题

时间:2016-06-30 12:45:15      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:

            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();

C#解决验证码问题

标签:

原文地址:http://www.cnblogs.com/H2921306656/p/5629536.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!