0916, color ball Exercises

Source: Internet
Author: User

while (true)

{

int[] Shuzu = new INT[7];

Random r = new Random ();

for (int i = 0; i < 6; i++)

{

Shuzu[i] = R.next (1, 32);

BOOL isOK = false;

for (int j = 0; J < i; J + +)

{

if (shuzu[j] = = Shuzu[i])

{

isOK = true;

}

}

if (isOK)

{

i--;

Continue

}

}

SHUZU[6] = R.next (1, 32);

Console.Write ("Please enter the red ball and basketball, separated by commas:");

String Shuru = Console.ReadLine ();

string[] ren = shuru. Split (', ');

int count = 0;

for (int i = 0; i < 6; i++)

{

for (int j = 0; J < 6; J + +)

{

if (int. Parse (ren[i]) = = Shuzu[j])

{

count++;

}

}

}

BOOL Islan = false;

if (int. Parse (ren[6]) = = Shuzu[6])

{

Islan = true;

}

foreach (int a in Shuzu)

{

Console.Write (A + "|");

}

if (count = = 6 && islan)

{

Console.WriteLine ("First Prize");

}

else if (count = = 6 &&!islan)

{

Console.WriteLine ("Second Prize");

}

else if (count = = 5 && islan)

{

Console.WriteLine ("Third Prize");

}

else if ((count = = 5 &&!islan) | | (Count = = 4 && islan))

{

Console.WriteLine ("Four Prizes");

}

else if ((count = = 4 &&!islan) | | (Count = = 3 && islan))

{

Console.WriteLine ("Five Prizes");

}

else if ((count = = 2 && islan) | | (count = = 1 && islan) | | (count = = 0 && islan))

{

Console.WriteLine ("Six Prizes");

}

Else

{

Console.WriteLine ("Not winning");

}

Console.ReadLine ();

0916, color ball Exercises

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.