zoukankan      html  css  js  c++  java
  • 猜拳练习

    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();

    }
    }
    }

  • 相关阅读:
    Valid Anagram
    Spiral Matrix II
    Spiral Matrix
    Kth Smallest Element in a BST
    Count Primes
    javascript 判断浏览器
    javascript 数值交换技巧
    EntityFramework 6 分页模式
    JSON.parse 和 JSON.stringify
    CSS z-index
  • 原文地址:https://www.cnblogs.com/weiwenxin01/p/5342654.html
Copyright © 2011-2022 走看看