猜拳
2015-06-18 15:41
323 查看
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { while (true) { Console.Write("请输入(0 || 1 || 2分别代表剪刀||锤|| 布):"); int a = int.Parse(Console.ReadLine()); Random r = new Random(); int PC = r.Next(3); Console.WriteLine("电脑为{0}", PC); if (a < 0 || a >= 3) { Console.WriteLine("请输入正确的数字!"); } else if (a == 2 &&PC ==0) { Console.WriteLine("你输了,真遗憾!"); } else if (PC == 2 && a == 0) { Console.WriteLine("你赢了,好棒!"); } else { if (a == PC) { Console.WriteLine("打平了,请继续努力!"); } else if (a > PC) { Console.WriteLine("你赢了,好棒!"); } else { Console.WriteLine("你输了,真遗憾!"); } } Console.ReadLine(); } } } }
相关文章推荐
- 3 Longest Substring Without Repeating Characters(最长不重复连续子串Medium)
- SQL AlawaysOn 之二:添加组织和域用户
- Linux环境下段错误的产生原因及调试方法小结
- Win10如何把喜欢的图片设置为桌面背景
- .md5mesh and .md5anim文件介绍
- 2322
- 你知道Material Type(ROH,HALB,FERT…)为什么缩写是ROH,HALB,FERT吗?哈哈哈
- 判断年月日是否正确
- xmlDom
- 团队项目第二次冲刺(2)
- LTE网络主要接口信息
- 关于多线程共享数据的一些疑惑
- sourcetree git 忽略文件
- 浅谈JAVA反射机制在Android应用开发中的应用
- sql 去除列中内容的单引号
- 工业串口和网络软件通讯平台(SuperIO 2.0)发布
- learn
- 【WEB】jsp向servlet传参中文乱码问题解决
- echar折线图
- Win7开机黑屏只有鼠标指针的问题如何解决