明日方舟吧 关注:1,701,575贴子:78,856,898

论c++怎么实现对公开招募的模拟

只看楼主收藏回复

直接上源码


IP属地:江苏1楼2020-03-28 19:41回复
    看看


    IP属地:河北来自iPhone客户端2楼2020-03-28 19:42
    回复
      <?xml version="1.0" encoding="GBK"?>
      <arknightsworker>
      <number> 66 </number>
      <worker No. = "1">
      <name> Castle-3 </name>
      <aptitude> 空 </aptitude>
      <place> 近战位 </place>
      <job> 近卫干员 </job>
      <tagone> 机械支援 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "2">
      <name> Lancet-2 </name>
      <aptitude> 空 </aptitude>
      <place> 远程位 </place>
      <job> 医疗干员 </job>
      <tagone> 机械支援 </tagone>
      <tagtwo> 治疗 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "3">
      <name> 夜刀 </name>
      <aptitude> 新手 </aptitude>
      <place> 近战位 </place>
      <job> 先锋干员 </job>
      <tagone> 空 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "4">
      <name> 杜林 </name>
      <aptitude> 新手 </aptitude>
      <place> 远程位 </place>
      <job> 术士干员 </job>
      <tagone> 空 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "5">
      <name> 12F </name>
      <aptitude> 新手 </aptitude>
      <place> 远程位 </place>
      <job> 术士干员 </job>
      <tagone> 空 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "6">
      <name> 巡林者 </name>
      <aptitude> 新手 </aptitude>
      <place> 远程位 </place>
      <job> 狙击干员 </job>
      <tagone> 空 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "7">
      <name> 黑角 </name>
      <aptitude> 新手 </aptitude>
      <place> 近战位 </place>
      <job> 重装干员 </job>
      <tagone> 空 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "8">
      <name> 米格鲁 </name>
      <aptitude> 空 </aptitude>
      <place> 近战位 </place>
      <job> 重装干员 </job>
      <tagone> 防护 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "9">
      <name> 玫兰莎 </name>
      <aptitude> 空 </aptitude>
      <place> 近战位 </place>
      <job> 近卫干员 </job>
      <tagone> 输出 </tagone>
      <tagtwo> 生存 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "10">
      <name> 克洛斯 </name>
      <aptitude> 空 </aptitude>
      <place> 远程位 </place>
      <job> 狙击干员 </job>
      <tagone> 输出 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "11">
      <name> 安德切尔 </name>
      <aptitude> 空 </aptitude>
      <place> 远程位 </place>
      <job> 狙击干员 </job>
      <tagone> 输出 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "12">
      <name> 芙蓉 </name>
      <aptitude> 空 </aptitude>
      <place> 远程位 </place>
      <job> 医疗干员 </job>
      <tagone> 治疗 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "13">
      <name> 安赛尔 </name>
      <aptitude> 空 </aptitude>
      <place> 远程位 </place>
      <job> 医疗干员 </job>
      <tagone> 治疗 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "14">
      <name> 炎熔 </name>
      <aptitude> 空 </aptitude>
      <place> 远程位 </place>
      <job> 术士干员 </job>
      <tagone> 群攻 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "15">
      <name> 史都华德 </name>
      <aptitude> 空 </aptitude>
      <place> 远程位 </place>
      <job> 术士干员 </job>
      <tagone> 输出 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "16">
      <name> 芬 </name>
      <aptitude> 空 </aptitude>
      <place> 近战位 </place>
      <job> 先锋干员 </job>
      <tagone> 费用回复 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "17">
      <name> 香草 </name>
      <aptitude> 空 </aptitude>
      <place> 近战位 </place>
      <job> 先锋干员 </job>
      <tagone> 输出 </tagone>
      <tagtwo> 费用回复 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "18">
      <name> 翎羽 </name>
      <aptitude> 空 </aptitude>
      <place> 近战位 </place>
      <job> 先锋干员 </job>
      <tagone> 输出 </tagone>
      <tagtwo> 费用回复 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "19">
      <name> 梓兰 </name>
      <aptitude> 空 </aptitude>
      <place> 远程位 </place>
      <job> 辅助干员 </job>
      <tagone> 减速 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "20">
      <name> 清道夫 </name>
      <aptitude> 空 </aptitude>
      <place> 近战位 </place>
      <job> 先锋干员 </job>
      <tagone> 输出 </tagone>
      <tagtwo> 费用回复 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "21">
      <name> 红豆 </name>
      <aptitude> 空 </aptitude>
      <place> 近战位 </place>
      <job> 先锋干员 </job>
      <tagone> 输出 </tagone>
      <tagtwo> 费用回复 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "22">
      <name> 末药 </name>
      <aptitude> 空 </aptitude>
      <place> 远程位 </place>
      <job> 医疗干员 </job>
      <tagone> 治疗 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "23">
      <name> 调香师 </name>
      <aptitude> 空 </aptitude>
      <place> 远程位 </place>
      <job> 医疗干员 </job>
      <tagone> 治疗 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "24">
      <name> 夜烟 </name>
      <aptitude> 空 </aptitude>
      <place> 远程位 </place>
      <job> 术士干员 </job>
      <tagone> 输出 </tagone>
      <tagtwo> 削弱 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "25">
      <name> 远山 </name>
      <aptitude> 空 </aptitude>
      <place> 远程位 </place>
      <job> 术士干员 </job>
      <tagone> 群攻 </tagone>
      <tagtwo> 空 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>
      <worker No. = "26">
      <name> 白雪 </name>
      <aptitude> 空 </aptitude>
      <place> 远程位 </place>
      <job> 狙击干员 </job>
      <tagone> 群攻 </tagone>
      <tagtwo> 减速 </tagtwo>
      <tagthree> 空 </tagthree>
      </worker>


      IP属地:江苏3楼2020-03-28 19:43
      回复
        彳亍


        IP属地:福建来自Android客户端4楼2020-03-28 19:44
        回复


          IP属地:安徽来自Android客户端5楼2020-03-28 19:45
          收起回复
            <worker No. = "27">
            <name> 流星 </name>
            <aptitude> 空 </aptitude>
            <place> 远程位 </place>
            <job> 狙击干员 </job>
            <tagone> 输出 </tagone>
            <tagtwo> 削弱 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "28">
            <name> 杰西卡 </name>
            <aptitude> 空 </aptitude>
            <place> 远程位 </place>
            <job> 狙击干员 </job>
            <tagone> 输出 </tagone>
            <tagtwo> 生存 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "29">
            <name> 地灵 </name>
            <aptitude> 空 </aptitude>
            <place> 远程位 </place>
            <job> 辅助干员 </job>
            <tagone> 减速 </tagone>
            <tagtwo> 空 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "30">
            <name> 蛇屠箱 </name>
            <aptitude> 空 </aptitude>
            <place> 近战位 </place>
            <job> 重装干员 </job>
            <tagone> 防护 </tagone>
            <tagtwo> 空 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "31">
            <name> 古米 </name>
            <aptitude> 空 </aptitude>
            <place> 近战位 </place>
            <job> 重装干员 </job>
            <tagone> 防护 </tagone>
            <tagtwo> 治疗 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "32">
            <name> 角峰 </name>
            <aptitude> 空 </aptitude>
            <place> 近战位 </place>
            <job> 重装干员 </job>
            <tagone> 防护 </tagone>
            <tagtwo> 空 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "33">
            <name> 砾 </name>
            <aptitude> 空 </aptitude>
            <place> 近战位 </place>
            <job> 特种干员 </job>
            <tagone> 防护 </tagone>
            <tagtwo> 快速复活 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "34">
            <name> 暗锁 </name>
            <aptitude> 空 </aptitude>
            <place> 近战位 </place>
            <job> 特种干员 </job>
            <tagone> 位移 </tagone>
            <tagtwo> 空 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "35">
            <name> 阿消 </name>
            <aptitude> 空 </aptitude>
            <place> 近战位 </place>
            <job> 特种干员 </job>
            <tagone> 位移 </tagone>
            <tagtwo> 空 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "36">
            <name> 幽灵鲨 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 近战位 </place>
            <job> 近卫干员 </job>
            <tagone> 群攻 </tagone>
            <tagtwo> 生存 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "37">
            <name> 因陀罗 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 近战位 </place>
            <job> 近卫干员 </job>
            <tagone> 输出 </tagone>
            <tagtwo> 生存 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "38">
            <name> 德克萨斯 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 近战位 </place>
            <job> 先锋干员 </job>
            <tagone> 控场 </tagone>
            <tagtwo> 费用回复 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "39">
            <name> 白面鸮 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 远程位 </place>
            <job> 医疗干员 </job>
            <tagone> 治疗 </tagone>
            <tagtwo> 支援 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "40">
            <name> 赫默 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 远程位 </place>
            <job> 医疗干员 </job>
            <tagone> 治疗 </tagone>
            <tagtwo> 空 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "41">
            <name> 华法琳 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 远程位 </place>
            <job> 医疗干员 </job>
            <tagone> 支援 </tagone>
            <tagtwo> 治疗 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "42">
            <name> 普罗旺斯 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 远程位 </place>
            <job> 狙击干员 </job>
            <tagone> 输出 </tagone>
            <tagtwo> 空 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "43">
            <name> 蓝毒 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 远程位 </place>
            <job> 狙击干员 </job>
            <tagone> 输出 </tagone>
            <tagtwo> 空 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "44">
            <name> 守林人 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 远程位 </place>
            <job> 狙击干员 </job>
            <tagone> 爆发 </tagone>
            <tagtwo> 输出 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "45">
            <name> 陨星 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 远程位 </place>
            <job> 狙击干员 </job>
            <tagone> 削弱 </tagone>
            <tagtwo> 群攻 </tagtwo>
            <tagthree> 空</tagthree>
            </worker>
            <worker No. = "46">
            <name> 白金 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 远程位 </place>
            <job> 狙击干员 </job>
            <tagone> 输出 </tagone>
            <tagtwo> 空 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "47">
            <name> 初雪 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 远程位 </place>
            <job> 辅助干员 </job>
            <tagone> 削弱 </tagone>
            <tagtwo> 空 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "48">
            <name> 真理 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 远程位 </place>
            <job> 辅助干员 </job>
            <tagone> 减速 </tagone>
            <tagtwo> 输出 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "49">
            <name> 梅尔 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 远程位 </place>
            <job> 辅助干员 </job>
            <tagone> 召唤 </tagone>
            <tagtwo> 控场 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>
            <worker No. = "50">
            <name> 临光 </name>
            <aptitude> 资深干员 </aptitude>
            <place> 近战位 </place>
            <job> 重装干员 </job>
            <tagone> 治疗 </tagone>
            <tagtwo> 防护 </tagtwo>
            <tagthree> 空 </tagthree>
            </worker>


            IP属地:江苏6楼2020-03-28 19:45
            回复
              <worker No. = "51">
              <name> 雷蛇 </name>
              <aptitude> 资深干员 </aptitude>
              <place> 近战位 </place>
              <job> 重装干员 </job>
              <tagone> 防护 </tagone>
              <tagtwo> 输出 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "52">
              <name> 火神 </name>
              <aptitude> 资深干员 </aptitude>
              <place> 近战位 </place>
              <job> 重装干员 </job>
              <tagone> 输出 </tagone>
              <tagtwo> 生存 </tagtwo>
              <tagthree> 防护 </tagthree>
              </worker>
              <worker No. = "53">
              <name> 可颂 </name>
              <aptitude> 资深干员 </aptitude>
              <place> 近战位 </place>
              <job> 重装干员 </job>
              <tagone> 位移 </tagone>
              <tagtwo> 防护 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "54">
              <name> 红 </name>
              <aptitude> 资深干员 </aptitude>
              <place> 近战位 </place>
              <job> 特种干员 </job>
              <tagone> 控场 </tagone>
              <tagtwo> 快速复活 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "55">
              <name> 狮蝎 </name>
              <aptitude> 资深干员 </aptitude>
              <place> 近战位 </place>
              <job> 特种干员 </job>
              <tagone> 输出 </tagone>
              <tagtwo> 空 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "56">
              <name> 崖心 </name>
              <aptitude> 资深干员 </aptitude>
              <place> 近战位 </place>
              <job> 特种干员 </job>
              <tagone> 位移 </tagone>
              <tagtwo> 输出</tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "57">
              <name> 食铁兽 </name>
              <aptitude> 资深干员 </aptitude>
              <place> 近战位 </place>
              <job> 特种干员 </job>
              <tagone> 位移 </tagone>
              <tagtwo> 减速 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "58">
              <name> 推进之王 </name>
              <aptitude> 高级资深干员 </aptitude>
              <place> 近战位 </place>
              <job> 先锋干员 </job>
              <tagone> 输出 </tagone>
              <tagtwo> 费用回复 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "59">
              <name> 闪灵 </name>
              <aptitude> 高级资深干员 </aptitude>
              <place> 远程位 </place>
              <job> 医疗干员 </job>
              <tagone> 治疗 </tagone>
              <tagtwo> 支援 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "60">
              <name> 夜莺 </name>
              <aptitude> 高级资深干员 </aptitude>
              <place> 远程位 </place>
              <job> 医疗干员 </job>
              <tagone> 治疗 </tagone>
              <tagtwo> 支援 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "61">
              <name> 伊芙利特 </name>
              <aptitude> 高级资深干员 </aptitude>
              <place> 远程位 </place>
              <job> 术士干员 </job>
              <tagone> 群攻 </tagone>
              <tagtwo> 削弱 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "62">
              <name> 能天使 </name>
              <aptitude>高级资深干员 </aptitude>
              <place> 远程位 </place>
              <job> 狙击干员 </job>
              <tagone> 输出 </tagone>
              <tagtwo> 空 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "63">
              <name> 银灰 </name>
              <aptitude> 高级资深干员 </aptitude>
              <place> 近战位 </place>
              <job> 近卫干员 </job>
              <tagone> 输出 </tagone>
              <tagtwo> 支援 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "64">
              <name> 塞雷娅 </name>
              <aptitude> 高级资深干员 </aptitude>
              <place> 近战位 </place>
              <job> 重装干员 </job>
              <tagone> 防护 </tagone>
              <tagtwo> 支援 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "65">
              <name> 星熊 </name>
              <aptitude> 高级资深干员 </aptitude>
              <place>近战位 </place>
              <job> 重装干员 </job>
              <tagone> 输出 </tagone>
              <tagtwo> 防护 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              <worker No. = "66">
              <name> 斯卡蒂 </name>
              <aptitude> 高级资深干员 </aptitude>
              <place> 近战位 </place>
              <job> 近卫干员 </job>
              <tagone> 输出 </tagone>
              <tagtwo> 生存 </tagtwo>
              <tagthree> 空 </tagthree>
              </worker>
              </arknightsworker>
              上面这些在arknightsworker.xml里


              IP属地:江苏7楼2020-03-28 19:47
              回复
                arknightslog.xml里长这样
                <?xml version="1.0" encoding="GBK" ?>
                <arknightslog>
                <log_number>2</log_number>
                <log No.="1">
                <last_rand_point>3175</last_rand_point>
                <rand_result>杜林</rand_result>
                </log>
                <log No.="2">
                <last_rand_point>3100</last_rand_point>
                <rand_result>玫兰莎</rand_result>
                </log>
                </arknightslog>


                IP属地:江苏9楼2020-03-28 19:49
                回复
                  arknightsdate.xml里长这样
                  <?xml version="1.0" encoding="GBK"?>
                  <arknightsdate>
                  <rand_point> 3000 </rand_point>
                  <four_star_number> 0 </four_star_number>
                  </arknightsdate>


                  IP属地:江苏10楼2020-03-28 19:49
                  回复
                    c++代码来了
                    #include <iostream>
                    #include <string>
                    #include <sstream>
                    #include "tinystr.h"
                    #include "tinyxml.h"
                    #include <time.h>
                    #include <stdlib.h>
                    using namespace std;
                    class arknights_worker {
                    public:
                    string name;
                    string aptitude;
                    string place;
                    string job;
                    string tag_one;
                    string tag_two;
                    string tag_three;
                    arknights_worker(string in_name,string in_aptitude,string in_place,string in_job,string in_tag_one,string in_tag_two,string in_tag_three) {
                    name = in_name;
                    aptitude = in_aptitude;
                    place = in_place;
                    job = in_job;
                    tag_one = in_tag_one;
                    tag_two = in_tag_two;
                    tag_three = in_tag_three;
                    }
                    };


                    IP属地:江苏11楼2020-03-28 19:50
                    回复
                      公开招募怎么可能模拟
                      概率都没公布
                      而且那些词条我觉得生成的过程相当复杂


                      IP属地:安徽12楼2020-03-28 19:50
                      收起回复
                        class tinyxml {
                        public:
                        int xml_read_number(const char *filepath) {
                        int i;
                        int number;
                        TiXmlDocument *xml = new TiXmlDocument();
                        if (xml == NULL) {
                        return -1;
                        }
                        xml -> LoadFile(filepath);
                        TiXmlElement *root = xml -> RootElement();
                        if (root == NULL) {
                        cout << "请检查arknightsworker.xml文件是否正确" << endl;
                        return -1;
                        }
                        TiXmlElement *first_child_element = root -> FirstChildElement();
                        if (first_child_element == NULL) {
                        cout << "请检查arknightsworker.xml文件是否正确" << endl;
                        return -1;
                        }
                        string snumber = first_child_element -> FirstChild() -> Value();
                        stringstream sstr(snumber);
                        sstr >> number;
                        delete xml;
                        return number;
                        }
                        int xml_read_rand_point () {
                        int rand_point;
                        const char *filepath = "arknightsdate.xml";
                        TiXmlDocument *xml = new TiXmlDocument();
                        if (xml == NULL) {
                        return -1;
                        }
                        xml -> LoadFile(filepath);
                        TiXmlElement *root = xml -> RootElement();
                        if (root == NULL) {
                        cout << "请检查arknightsdate.xml文件是否正确" << endl;
                        return -1;
                        }
                        TiXmlElement *first_child_element = root -> FirstChildElement();
                        if (first_child_element == NULL) {
                        cout << "请检查arknightsdate.xml文件是否正确" << endl;
                        return -1;
                        }
                        string srand_point = first_child_element -> FirstChild() -> Value();
                        stringstream sstr(srand_point);
                        sstr >> rand_point;
                        delete xml;
                        return rand_point;
                        }
                        int xml_read_four_star_number () {
                        int four_star_number;
                        const char *filepath = "arknightsdate.xml";
                        TiXmlDocument *xml = new TiXmlDocument();
                        if (xml == NULL) {
                        return -1;
                        }
                        xml -> LoadFile(filepath);
                        TiXmlElement *root = xml -> RootElement();
                        if (root == NULL) {
                        cout << "请检查arknightsdate.xml文件是否正确" << endl;
                        return -1;
                        }
                        TiXmlElement *first_child_element = root -> FirstChildElement();
                        if (first_child_element == NULL) {
                        cout << "请检查arknightsdate.xml文件是否正确" << endl;
                        return -1;
                        }
                        TiXmlElement *second_child_element = first_child_element -> NextSiblingElement();
                        if (second_child_element == NULL) {
                        cout << "请检查arknightsdate.xml文件是否正确" << endl;
                        return -1;
                        }
                        string sfour_star_number = second_child_element -> FirstChild() -> Value();
                        stringstream sstr(sfour_star_number);
                        sstr >> four_star_number;
                        delete xml;
                        return four_star_number;
                        }
                        int xml_write_result (const char *log_number,const char *rand_point,const char *rand_result) {
                        TiXmlDocument *xml = new TiXmlDocument();
                        const char *filepath = "arknightslog.xml";
                        const char *slog_number = log_number;
                        const char *srand_point = rand_point;
                        const char *srand_result = rand_result;
                        xml -> LoadFile(filepath);
                        TiXmlElement *root = xml -> RootElement();
                        if (root == NULL) {
                        cout << "请检查arknightslog.xml文件是否正确" << endl;
                        return -1;
                        }
                        TiXmlElement *first_child_element = root -> FirstChildElement();
                        if (first_child_element == NULL) {
                        cout << "请检查arknightslog.xml文件是否正确" << endl;
                        return -1;
                        }
                        first_child_element -> Clear();
                        TiXmlText *Value = new TiXmlText(slog_number);
                        first_child_element -> LinkEndChild(Value);
                        TiXmlElement *new_father_element = new TiXmlElement("log");
                        new_father_element -> SetAttribute("No.",log_number);
                        TiXmlElement *new_first_child_element = new TiXmlElement("last_rand_point");
                        TiXmlElement *new_second_child_element = new TiXmlElement("rand_result");
                        TiXmlText *new_first_child_element_Value = new TiXmlText(srand_point);
                        TiXmlText *new_second_child_element_Value = new TiXmlText(srand_result);
                        new_first_child_element -> LinkEndChild(new_first_child_element_Value);
                        new_second_child_element -> LinkEndChild(new_second_child_element_Value);
                        new_father_element -> LinkEndChild(new_first_child_element);
                        new_father_element -> LinkEndChild(new_second_child_element);
                        root -> LinkEndChild(new_father_element);
                        xml -> SaveFile(filepath);
                        }
                        };


                        IP属地:江苏13楼2020-03-28 19:50
                        回复
                          687987908方舟群有兴趣加


                          IP属地:北京来自iPhone客户端14楼2020-03-28 19:50
                          回复
                            入口函数来了
                            int main () {
                            const char *filepath = "arknightsworker.xml";
                            string esc;
                            tinyxml tinyxml;
                            int i,j,k,m,n;
                            /*常数初始化 */
                            //读取干员总数
                            int number;
                            number = tinyxml.xml_read_number(filepath);
                            if (number == -1) {
                            cout << "程序运行时出错" << endl << "输入任意非空格、制表、回车字符以退出程序" << endl;
                            cin >> esc;
                            return 0;
                            }
                            //生成干员对象数组
                            string in_name;
                            string in_aptitude;
                            string in_place;
                            string in_job;
                            string in_tag_one;
                            string in_tag_two;
                            string in_tag_three;
                            arknights_worker **worker = new arknights_worker *[number];
                            TiXmlDocument *xml = new TiXmlDocument();
                            xml -> LoadFile(filepath);
                            TiXmlElement *root = xml -> RootElement();
                            TiXmlElement *first_child_element = root -> FirstChildElement();
                            TiXmlElement *work = first_child_element -> NextSiblingElement();
                            if (work == NULL) {
                            cout << "请检查arknightsdate.xml文件是否正确" << endl;
                            return 0;
                            }
                            for (i = 0;i < number;i ++) {
                            TiXmlElement *name = work -> FirstChildElement();
                            in_name = name -> FirstChild() -> Value();
                            TiXmlElement *aptitude = name -> NextSiblingElement();
                            in_aptitude = aptitude -> FirstChild() -> Value();
                            TiXmlElement *place = aptitude -> NextSiblingElement();
                            in_place = place -> FirstChild() -> Value();
                            TiXmlElement *job = place -> NextSiblingElement();
                            in_job = job -> FirstChild() -> Value();
                            TiXmlElement *tag_one = job -> NextSiblingElement();
                            in_tag_one = tag_one -> FirstChild() -> Value();
                            TiXmlElement *tag_two = tag_one -> NextSiblingElement();
                            in_tag_two = tag_two -> FirstChild() -> Value();
                            TiXmlElement *tag_three = tag_two -> NextSiblingElement();
                            in_tag_three = tag_three -> FirstChild() -> Value();
                            worker[i] = new arknights_worker(in_name,in_aptitude,in_place,in_job,in_tag_one,in_tag_two,in_tag_three);
                            if (! work -> NoChildren()) {
                            TiXmlElement *middle = work -> NextSiblingElement();
                            work = middle;
                            }
                            }
                            delete xml;
                            int rand_point,rand_point_work;


                            IP属地:江苏15楼2020-03-28 19:51
                            回复
                              Printif(牛逼)


                              IP属地:广东来自Android客户端16楼2020-03-28 19:51
                              收起回复