Loop Nesting iterative practice scissors

Source: Internet
Author: User

//Scissors//three innings two wins, the computer even wins two innings, or the player even wins two innings, 2 innings ends//the computer wins a game, the player wins a game, 3 innings//a draw, I don't know how many innings will end,//as long as the computer or the player wins 2 innings, then the end, otherwise continue//Break End Loop//continue end Current loop, enter Next loopintCount1 =0;intCount2 =0; for (; ; ) {Console.Write ("Please enter the gesture you want: (scissors: 0, Cloth: 1, Stone: 2)"); intYH =int.   Parse (Console.ReadLine ()); Random R=NewRandom (); intDN = R.next (0,3); intJG = YH-DN; if(JG = =-1|| JG = =2) {Count1++; Console.WriteLine ("congratulations on your victory! "); if(Count1 = =2) {Console.WriteLine ("win!! ");  Break; }   }   Else if(JG = =1|| JG = =-2) {Count2++; Console.WriteLine ("You've lost! "); if(Count2 = =2) {Console.WriteLine ("defeat!! ");  Break; }   }   Else{Console.WriteLine ("A Draw! "); }}
Console.ReadLine ();

 // One of the monkeys picked a few peaches, each day it ate half of the peaches and one, and on the 10th day there was a peach,// asked how many peaches had been picked;int 1 ;  for (int1; i--) {    12;} Console.WriteLine (a);
Console.ReadLine ();

Loop Nesting iterative practice scissors

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.