zoukankan      html  css  js  c++  java
  • 猜拳

    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();
                }
            }
        }
    }
  • 相关阅读:
    beta版本冲刺七
    beta版本冲刺六
    beta版本冲刺五
    beta版本冲刺四
    beta版本冲刺三
    Beta版本冲刺(二)
    项目评测
    beta版本冲刺(一)
    福大软工 · 最终作业
    福大软工 · 第十二次作业
  • 原文地址:https://www.cnblogs.com/qixinjian/p/4586029.html
Copyright © 2011-2022 走看看