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

  • 相关阅读:
    Arduino 各种模块篇 DHT11 温度湿度 数字模块 单总线
    Arduino 各种模块篇 火焰传感器
    exception
    google c++ code style
    昙花一现
    晏才宏
    win 2003 玩3D游戏设置
    生成多文件的Assembly 的两种方法
    怎样使自己写的程序集出现在Visual Studio Add Reference 的 .NET Tab页中
    安装将仅在管理模式下运行,安装终止
  • 原文地址:https://www.cnblogs.com/H2921306656/p/5622829.html
Copyright © 2011-2022 走看看