课后作业 05 -- 输出一段带字母与数字的随机数

            Console.Write("您欲得到四位随机验证码的数量是:");
            int a = int.Parse(Console.ReadLine());
            Console.WriteLine("随机验证码依次为:");
            char[] arr = new char[] {'1','2','3','4','5','6','7','8','9','a','b','c','d','e','f',
                'g','h','i','j','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
            for (int c = 1;c <= a; c++)
            {
                string str1 = string.Empty;
                for (int d = 1; d <= 4; d++)
                {
                    Random b = new Random();
                    Thread.Sleep(500);
                    int e = b.Next(0,34);
                    str1 += arr[e];
                }
                Console.WriteLine(str1);
            }
            Console.WriteLine("程序运行结束!谢谢使用");
            Console.ReadLine();

  

posted @ 2015-08-07 23:38  WhyToHow  阅读(139)  评论(0编辑  收藏  举报