SoFunction
Updated on 2025-03-07

Simple example of C# dealing with rock-scissors problem (non-form)

Simple example of C# dealing with rock-scissors problem (non-form)

//Russiasm, 3 wins in 5 games, and 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 "people";

      }

      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 ( < 3 &&  < 3)

      {

        ("Please enter the digital code of the scissors stone cloth (1 is scissors, 2 is stone, and 3 is cloth):");

        int a = (());

        int b = (1,4);

        string jg = (a, b);

        switch (jg)

        {

          case "people":

            ++;

            ("You win this game");

            break;

          case "computer":

            ++;

            ("This game wins");

            break;

          case "and":

            ("This game draw");

            break;

        }

        

      }

      if ( > )

      {

        ("You won");

      }

      else

      {

        ("You lost");

 

      }

      ();

    }

  }

}

The above simple example (non-form) of C# dealing with rock-scissors problem is all the content I share with you. I hope you can give you a reference and I hope you can support me more.