1.
intp =1; intS1 =0, SHU1 =0; while(true) {Random R=NewRandom (); intShu = R.next (3); Console.WriteLine ("0-Burden, 1-scissors, 2-hammerhead"); Console.WriteLine ("Please enter any one of the 0,1,2 three numbers:"); ints =int. Parse (Console.ReadLine ()); if(s = =0) {Console.WriteLine ("you're a burden ."); } if(s = =1) {Console.WriteLine ("you out of scissors ."); } if(s = =2) {Console.WriteLine ("you're a hammer ."); } if(Shu = =0) {Console.WriteLine ("a computer is a burden"); } if(Shu = =1) {Console.WriteLine ("Computer out Scissors"); } if(Shu = =2) {Console.WriteLine ("computer out of the hammer"); } if(s = =Shu) {Console.WriteLine ("This council is a draw ."); } if(s = =0&& Shu = =2) || (s = =1&& Shu = =0) || (s = =2&& Shu = =1) {Console.WriteLine ("This council, you won."); S1= S1 +1; } if(Shu = =0&& s = =2) || (Shu = =1&& s = =0) || (Shu = =2&& s = =1) {Console.WriteLine ("the computer won the game."); SHU1= Shu1 +1; } Console.WriteLine ("Number of games:"+ P +"Bureau"); P+=1; if(p = =4) { Break; } console.readline (); } console.readline (); if(s1>shu1) {Console.WriteLine ("congratulations on your 3 innings ."+s1+"Victory wins"); } if(S1 <shu1) {Console.WriteLine ("I'm sorry you're 3 innings ."+shu1+"defeat to the computer"); } if(s1==shu1) {Console.WriteLine ("Draw"); }
2.
intfenshu1=0, fenshu2=0; for(inti =1; I <=3; i++) {Random R=NewRandom (); intShu = R.next (3); Console.WriteLine ("0-Burden, 1-scissors, 2-hammerhead"); Console.WriteLine ("Please enter any one of the 0,1,2 three numbers:"); ints =int. Parse (Console.ReadLine ()); if(s = =0) {Console.WriteLine ("you're a burden ."); } if(s = =1) {Console.WriteLine ("you out of scissors ."); } if(s = =2) {Console.WriteLine ("you're a hammer ."); } if(Shu = =0) {Console.WriteLine ("a computer is a burden"); } if(Shu = =1) {Console.WriteLine ("Computer out Scissors"); } if(Shu = =2) {Console.WriteLine ("computer out of the hammer"); } if(s = =Shu) {Console.WriteLine ("This council is a draw ."); } if(s = =0&& Shu = =2) || (s = =1&& Shu = =0) || (s = =2&& Shu = =1) {Console.WriteLine ("This council, you won."); FENSHU1= Fenshu1 +1; } if(Shu = =0&& s = =2) || (Shu = =1&& s = =0) || (Shu = =2&& s = =1) {Console.WriteLine ("the computer won the game."); FENSHU2= Fenshu2 +1; } console.readline (); } if(Fenshu1 >fenshu2) {Console.WriteLine ("congratulations on your success! "); } if(Fenshu1 <fenshu2) {Console.WriteLine ("I'm sorry you lost! "); } if(FENSHU1 = =fenshu2) {Console.WriteLine ("Draw"); }
Random number Scissors