C realizes simple two color ball extraction winning number code

  • 2021-10-25 07:39:36
  • OfStack

Don't talk too much nonsense, just post the code for everyone. I'm just so ruthless. . .

The key code is as follows:


int[] ss = new int[6];
Random s = new Random();
Console.WriteLine(" Two-color sphere random: ");
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(" Red Ball: \t");
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] + "\t");
}
for (int i = 0; i < 7 ; i++)
{
int b = s.Next(1, 17);
if (i == 6)
{
Console.Write(" Basketball: " + b + "\t");
}
else
{
continue ;
}
}
Console.ReadLine();

Related articles: