标签:
Random t = new Random();
string x, y;
int a = t.Next(0,3);
int b = t.Next(0,3);
switch (a)
{
case 0:
x = "剪刀";
break;
case 1:
x = "石头";
break;
case 2:
x = "布";
break;
default:
x = "不带耍赖的!!";
break;
}
switch (b)
{
case 0:
y = "剪刀";
break;
case 1:
y = "石头";
break;
case 2:
y = "布";
break;
default:
y = "不带耍赖的!!";
break;
}
Console.WriteLine("x出" + x);
Console.WriteLine("y出" + y);
if (a==b)
{
Console.WriteLine("平局!");
}
else if (a-b==1||a-b==-2)
{
Console.WriteLine("x赢了");
}
else
{
Console.WriteLine("y赢了");
}
标签:
原文地址:http://www.cnblogs.com/lovesy2413/p/4309123.html