zoukankan      html  css  js  c++  java
  • C#双色球——简单抽取中奖号码

                int[] ss = new int[6];
                Random s = new Random();
                Console.WriteLine("双色球随机:");
                for (int i = 0; i < 6; i++)
                {
                    bool b = true;
                    int a = s.Next(1, 34);
                    for (int j = 0; j < i; j++)
                    {
                        if (a == ss[j])
                        {
                            b = false;
                            i--;
                        }
                    }
                    if (b)
                    {
                        ss[i] = a;
                    }
                }
                Console.Write("红球: ");
                for (int i = 0; i < 6; i++)
                {
                    for (int j = i; j < 5; j++)
                    {
                        if (ss[i] > ss[j + 1])
                        {
                            int zhong = ss[i];
                            ss[i] = ss[j + 1];
                            ss[j + 1] = zhong;
                        }
                    }
                   
                    Console.Write(ss[i] + " ");
                }
                 for (int i = 0; i < 7 ; i++)
                {
                    int b = s.Next(1, 17);
                    if (i == 6)
                    {
                        Console.Write("蓝球:" + b + " ");
                    }
                    else
                    {
                        continue ;
                    }
                }
                Console.ReadLine();

  • 相关阅读:
    javascript的全局变量和局部变量
    Google Analytics统计代码GA.JS
    display和visible的区别
    div+css实现带三角箭头提示框
    css兼容IE8的一个简便方法 [转]
    20个值得关注最新的jQuery Plugins
    分享40多个新鲜的jQuery图片和内容幻灯插件
    JQuery插件让图片旋转任意角度且代码极其简单
    Android UI dp sp
    MaxScript用二进制读取方式获取Max文件版本
  • 原文地址:https://www.cnblogs.com/H2921306656/p/5622829.html
Copyright © 2011-2022 走看看