猜拳练习

namespace ConsoleApplication13
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 3; i++)
{


Random r = new Random();
int s = r.Next(3);
Console.WriteLine("0-包袱,1-剪刀,2-锤头");


Console.WriteLine("请输入一个数:");
int c = int.Parse(Console.ReadLine());


if (s == 0)
{
Console.WriteLine("电脑出包袱");
}
else if (s == 1)
{
Console.WriteLine("电脑出剪刀");
}
else if (s == 2)
{
Console.WriteLine("电脑出锤头");
}
if ((c == 0 && s == 0) || (c == 1 && s == 1) || (c == 2 && s == 2))
{
Console.WriteLine("平局");
}
if ((c == 0 && s == 2) || (c == 1 && s == 0) || (c == 2 && s == 1))
{
Console.WriteLine("你赢了");
}
else if ((c == 0 && s == 1) || (c == 1 && s == 2) || (c == 2 && s == 0))
{
Console.WriteLine("电脑赢了");
}

else
{
Console.WriteLine("请输入正确的数字");

}
}
Console.ReadLine();

}
}
}

原文地址:https://www.cnblogs.com/weiwenxin01/p/5342654.html