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)