标题:石头剪刀布游戏 帮忙查找错误
取消只看楼主
luochengwww
Rank: 2
等 级:论坛游民
帖 子:40
专家分:48
注 册:2010-3-31
结帖率:100%
 问题点数:0 回复次数:1 
石头剪刀布游戏 帮忙查找错误
int b = 0;
            for (int i = 0; b != 5; i++)
            {
                // 计算机出拳
                int a, c = 0, d = 0, e = 0;
                Random r = new Random();
                a = r.Next(1, 3);
                Console.WriteLine("请出拳:其中1代表拳头;2代表剪刀;3代表布");
                b = Convert.ToInt32(Console.Read());

                Console.WriteLine("你出拳为{1}  +  计算机为{2}", b, a);
                if (a == b)
                {
                    Console.WriteLine(" 平局  ");
                    c = c + 1;
                }
                else if ((a == 1 && b == 2) || (a == 2 && b == 3) || (a == 3 && b == 1))
                {
                    Console.WriteLine("你输了");
                    d = d + 1;
                }
                else
                {
                    Console.WriteLine("你赢了");
                    e = e + 1;
                }
                Console.WriteLine("不玩时请输入5");
                b = Convert.ToInt32(Console.ReadLine());
                if (b == 5)
                {
                    int f = c + d + e;
                    Console.WriteLine("共玩{0}  为胜局为{1}   平局为{2}   负局为{3}", f, e, c, d);
                }
            }
搜索更多相关主题的帖子: 石头 剪刀 游戏 
2010-04-17 15:13
luochengwww
Rank: 2
等 级:论坛游民
帖 子:40
专家分:48
注 册:2010-3-31
得分:0 
谢谢
谢谢各位!!!!
2010-04-20 21:51



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-303382-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.094960 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved