zoukankan      html  css  js  c++  java
  • 结构体英雄联盟练一练

    namespace 结构体英雄联盟练一练
    {
        class Program
        {
            struct player
            {
                public string name;
                public int dengji;
                public zy z;
                public zb cz;
            }
            struct zy
            {
                public int ll;
                public int zh;
                public int mj;
                public int fy;
            }
            struct zb
            {
                public string sx;
                public string wj;
                public string yx;
                public string ny;  
            }
            static void Main(string[] args)
            {
                player a = new player();
                a.name = "李青";
                a.dengji = 1;
                a.z.ll = 50;
                a.z.zh = 30;
                a.z.mj = 100;
                a.z.fy = 43;
                a.cz.sx = "三项之力";
                a.cz.wj = "无尽之刃";
                a.cz.yx = "饮血剑";
                a.cz.ny = "女妖面纱";
              
                player b = new player();
                b.name = "亚索";
                b.dengji = 1;
                b.z.ll = 100;
                b.z.zh = 15;
                b.z.mj = 100;
                b.z.fy = 43;
                b.cz.sx = "斯塔缇克电刃";
                b.cz.wj = "无尽之刃";
                b.cz.yx = "破败王者之刃";
                b.cz.ny = "春哥甲";

                Console.WriteLine("英雄名称:"+a.name+" 等级:"+a.dengji+" 力量:"+a.z.ll+" 智慧:"+a.z.zh+" 敏捷:"+a.z.mj+" 防御:"+a.z.fy+" 装备:"+(a.cz.sx+" "+a.cz.wj+" "+a.cz.yx+" "+a.cz.ny));
                Console.WriteLine();  
                Console.WriteLine("英雄名称:" + b.name + " 等级:" + b.dengji + " 力量:" + b.z.ll + " 智慧:" + b.z.zh + " 敏捷:" + b.z.mj + " 防御:" +b.z.fy+ " 装备:" + (b.cz.sx + " " + b.cz.wj + " " + b.cz.yx + " " + b.cz.ny));
               
                //下面开始计算伤害
                //气血=默认值+力量*等级*1+防御*等级*2
                //能量=默认值+智慧*等级*2+敏捷*等级
                int qx = 200 + a.z.ll * a.dengji * 1 + a.z.fy *  a.dengji* 2;
                int nl =100 + a.z.zh * a.dengji * 1 + a.z.mj * a.dengji * 2;
                int qx1 = 200 + b.z.ll * b.dengji * 1 + b.z.fy * b.dengji * 2;
                int nl1 = 100 + b.z.zh * b.dengji * 1 + b.z.mj * b.dengji * 2;

                Console.WriteLine(a.name+"气血:"+qx+" 能量:"+nl+" "+b.name+"气血:"+qx1+" 能量:"+nl1);
               
               
               
               
                Console.ReadLine();
            }
        }
    }

  • 相关阅读:
    YTU 2802: 判断字符串是否为回文
    YTU 2392: 求各位数字之和
    YTU 2391: 求素数
    HDU 2064:汉诺塔III
    HDU 2187:悼念512汶川大地震遇难同胞——老人是真饿了
    HDU 2036:改革春风吹满地
    HDU 1081:To The Max
    HDU 1257:最少拦截系统
    YTU 2425: C语言习题 输出月份
    YTU 2420: C语言习题 不等长字符串排序
  • 原文地址:https://www.cnblogs.com/lk-kk/p/4404209.html
Copyright © 2011-2022 走看看