C # Handling Scissors issues (non-forms)

Source: Internet
Author: User

Scissors, 5 innings 3 wins, requires the use of common variables.

Namespace structure Review _ Common variables

{

Class Program

{public int rz=0;

public int dz = 0;

public string BJ (int a, int b)

{

int d = A-B;

if (d==-2| | D==1)

{

return "person";

}

else if (d==2| | D==-1)

{

return "Computer";

}

Else

{

Return "and";

}

}

static void Main (string[] args)

{Random SJ = new Random ();

Program Zdy=new program ();

while (Zdy.rz < 3 && Zdy.dz < 3)

{

Console.WriteLine ("Please enter the digital code of the Scissors stone cloth (1 for scissors, 2 for stone, 3 for cloth):");

int a = Int. Parse (Console.ReadLine ());

int b = SJ. Next (1,4);

String JG = ZDY.BJ (A, b);

Switch (JG)

{

Case "Person":

zdy.rz++;

Console.WriteLine ("You win this Council");

Break

Case "Computer":

zdy.dz++;

Console.WriteLine ("Computer wins in this Council");

Break

Case "and":

Console.WriteLine ("Draw in this council");

Break

}

}

if (Zdy.rz > Zdy.dz)

{

Console.WriteLine ("You Won");

}

Else

{

Console.WriteLine ("You Lost");

}

Console.ReadLine ();

}

}

}

C # Handling Scissors issues (non-forms)

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.