码迷,mamicode.com
首页 > 其他好文 > 详细

随机验证码

时间:2015-08-09 15:30:30      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _26个字母_0_9随机产生验证码
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入四位数验证码(第二位开始为字母 0-25表示)");
            string[] s1 = { "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" };
            
            Random rd = new Random();
            
            for (int i = 0; i < 10;)
            {
                Console.Write("验证码:"+rd.Next(0,9));
                Console.Write(" ");
                Console.Write(rd.Next(s1.Length));
                Console.Write(" ");
                Console.Write(rd.Next(s1.Length));
                Console.Write(" ");
                Console.WriteLine(rd.Next(s1.Length));
                Console.ReadLine();
                
            }
            
        }
    }
}

 

随机验证码

标签:

原文地址:http://www.cnblogs.com/xubin-747/p/4715137.html

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