zoukankan      html  css  js  c++  java
  • 20140818if语句 jack

    if语句

    大体可以分一下几种:

    例:

     //跟电脑猜拳             Console.Write("请出拳");             string human = Console.ReadLine();             Console.WriteLine("人VS电脑");

                Random a = new Random();             int x = a.Next(3);             String computer;             if (x == 0)             {                 computer = "剪刀";             }             else if (x == 1) ;             {                 computer = "拳头";             }             else                 computer = "布";

                Console.WriteLine(human + "VS" + computer);             int b = 3;             if (human ! = "剪刀"&&human !"拳头"&&human !"布" )             {                  Console.WriteLine("输入错误");             }             else if(human == "剪刀")             {              b = 0;             }             else if(human == "拳头")             {              b = 1;             }             else                 b =2;

               if ((b - x == 1)||(b - x == 2))            {                Console.WriteLine("你赢了");            }             else if ((b - x == 1)||(b - x == 2))            {              Console.WriteLine("你输了");             }             else if ((b == x )             {             Console.WriteLine("再来一次吧");             }             else                 Console.WriteLine("输入错误");

     //体重称量器             Console.Write("请输入您的体重");             bool eals= Convert.ToBoolean( Console.ReadLine());             Console.Write("请输入您的身高");             bool HHH= Convert.ToBoolean( Console.ReadLine());             Console.Write("请输入您的性别");             bool xxx = Convert.ToBoolean(Console.ReadLine());             if (xxx == true)             {                 int s = HHH - 100;                 if (eals > (s + 3));                 {                     Console.Write("胖");                 }                 else if ((eals < = (s +3 )&&(eals>=s-3)))                 {                 Console.Write("正常");                 }                 else                     Console.Write("你太瘦了");             }             else                 int s=HHH - 110                 if(eals > (s + 3));             {                     Console.Write("胖");             }

                  else if((eals < = (s +3 )&&(eals>=s-3)))               {                Console.Write("正常");               }               else                    Console.Write("你太瘦了");

  • 相关阅读:
    Android OpenGL ES 2.0 (四) 灯光perfragment lighting
    Android OpenGL ES 2.0 (五) 添加材质
    冒泡排序函数
    javascript object 转换为 json格式 toJSONString
    Liunx CentOS 下载地址
    jquery 图片切换特效 鼠标点击左右按钮焦点图切换滚动
    javascript 解析csv 的function
    mysql Innodb Shutdown completed; log sequence number解决办法
    Centos 添加 yum
    javascript 键值转换
  • 原文地址:https://www.cnblogs.com/jackjms/p/3918731.html
Copyright © 2011-2022 走看看