明日方舟吧 关注:1,704,671贴子:79,109,566

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

取消只看楼主收藏回复

直接上源码


IP属地:江苏1楼2020-03-28 19:41回复
    <?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
    回复
      <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
              回复
                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
                回复
                  入口函数来了
                  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
                  回复
                    //读取4星计量数
                    int four_star_number;
                    four_star_number = tinyxml.xml_read_four_star_number();
                    if (four_star_number == -1) {
                    cout << "程序运行时出错" << endl << "输入任意非空格、制表、回车字符以退出程序" << endl;
                    cin >> esc;
                    return 0;
                    }
                    /*常数初始化完成 */
                    //欢迎语
                    int log_number;
                    string log,last_rand_point,rand_result;
                    const char *second_filepath = "arknightslog.xml";
                    cout << "欢迎使用明日方舟公开招募模拟器" << endl;
                    cout << "请选择以下一项以开始运行:" << endl << "1.开始模拟" << endl << "2.读取日志文件" << endl;
                    cout << "请输入以上项目所对应的序号" << endl;
                    cin >> i;
                    int _log = 1;
                    while (true) {
                    if (i == 1 || i == 2) {
                    break;
                    } else {
                    cout << "输入的序号不符合要求,请从新输入" << endl;
                    cin.clear();
                    cin.ignore(100,'\n');
                    cin >> i;
                    }
                    }
                    if (i == 2) {
                    TiXmlDocument *xml = new TiXmlDocument();
                    xml -> LoadFile(second_filepath);
                    TiXmlElement *root = xml -> RootElement();
                    if (root == NULL) {
                    cout << "请检查arknightslog.xml文件是否正确" << endl;
                    cout << "程序运行时出错" << endl << "输入任意非空格、制表、回车字符以退出程序" << endl;
                    cin >> esc;
                    return 0;
                    }
                    TiXmlElement *first_child_element = root -> FirstChildElement();
                    if (first_child_element == NULL) {
                    cout << "请检查arknightslog.xml文件是否正确" << endl;
                    cout << "程序运行时出错" << endl << "输入任意非空格、制表、回车字符以退出程序" << endl;
                    cin >> esc;
                    return 0;
                    }
                    if (first_child_element -> NextSiblingElement() == NULL) {
                    cout << "请先完整运行几次本程序再读取日志文件" << endl;
                    cout << "下面自动开始模拟" << endl;
                    _log = 0;
                    } else {
                    string slog_number = first_child_element -> FirstChild() -> Value();
                    stringstream sstr(slog_number);
                    sstr >> log_number;
                    cout << "当前共进行模拟" << log_number << "次" << endl;
                    TiXmlElement *work = first_child_element -> NextSiblingElement();
                    cout << "| 序号 | 剩余随机点数 | 获取干员的代号 | " << endl;
                    while (work != NULL) {
                    TiXmlAttribute *_log = work -> FirstAttribute();
                    log = _log -> Value();
                    cout << "|";
                    k = (8 - log.length()) / 2;
                    for (i = 0;i < k;i ++) {
                    cout << " ";
                    }
                    cout << log;
                    if ((8 - log.length()) % 2 == 1) {
                    k ++;
                    }
                    for (i = 0;i < k;i ++) {
                    cout << " ";
                    }
                    cout << "|";
                    TiXmlElement *_last_rand_point = work -> FirstChildElement();
                    last_rand_point = _last_rand_point -> FirstChild() -> Value();
                    k = (14 - last_rand_point.length()) / 2;
                    for (i = 0;i < k;i ++) {
                    cout << " ";
                    }
                    cout << last_rand_point;
                    if ((14 - last_rand_point.length()) % 2 == 1) {
                    k ++;
                    }
                    for (i = 0;i < k;i ++) {
                    cout << " ";
                    }
                    cout << "|";
                    TiXmlElement *_rand_result = _last_rand_point -> NextSiblingElement();
                    rand_result = _rand_result -> FirstChild() -> Value();
                    k = (16 - rand_result.length()) / 2;
                    for (i = 0;i < k;i ++) {
                    cout << " ";
                    }
                    cout << rand_result;
                    if ((16 - rand_result.length()) % 2 == 1) {
                    k ++;
                    }
                    for (i = 0;i < k;i ++) {
                    cout << " ";
                    }
                    cout << "|" << endl;;
                    if (! work -> NoChildren()) {
                    TiXmlElement *middle = work -> NextSiblingElement();
                    work = middle;
                    } else {
                    work = NULL;
                    }
                    }
                    }


                    IP属地:江苏17楼2020-03-28 19:51
                    回复
                      delete xml;
                      if (_log == 1) {
                      cout << "已完成日志文件的读取,请选择以下一项操作" << endl;
                      cout << "1.继续模拟" << endl << "2.退出程序" << endl;
                      cout << "请输入以上项目所对应的序号" << endl;
                      cin.clear();
                      cin.ignore(100,'\n');
                      cin >> i;
                      while (true) {
                      if (i == 1 || i == 2) {
                      break;
                      } else {
                      cout << "输入的序号不符合要求,请从新输入" << endl;
                      cin.clear();
                      cin.ignore(100,'\n');
                      cin >> i;
                      }
                      }
                      if (i == 2) {
                      cout << "谢谢使用" << endl << "输入任意非空格、制表、回车字符以退出程序" << endl;
                      cin >> esc;
                      return 0;
                      }
                      }
                      }
                      string tag [140];
                      int p_one,p_two,p_four,p_five,p_six;
                      while (true) {
                      //读取稀有度计量数
                      rand_point = tinyxml.xml_read_rand_point();
                      if (rand_point == -1) {
                      cout << "程序运行时出错" << endl << "输入任意非空格、制表、回车字符以退出程序" << endl;
                      cin >> esc;
                      return 0;
                      }
                      rand_point_work = rand_point;
                      p_one = 0;
                      p_two = 0;
                      p_four = 0;
                      p_five = 0;
                      p_six = 0;
                      int rand_number[20];
                      //生成干员列表
                      srand((unsigned)time(NULL));
                      j = 0;
                      for (i = 0;i < 20;i ++) {
                      if (p_one <= 1) {
                      m = (rand() % 100) +1;
                      }
                      if (p_six <= 1) {
                      n = (rand() % 200) +1;
                      }
                      if (four_star_number == 8) {
                      k = (rand() % 16) + 20;
                      four_star_number = 0;
                      } else if (m == 26 || m == 29) {
                      k = (rand() % 2) +1;
                      } else if (n == 26) {
                      k = (rand() % 9) + 58;
                      } else if (rand_point_work <= 5000 && p_two <3) {
                      k = (rand() % 17) + 3;
                      } else if (rand_point_work > 5000 && rand_point_work <= 6000 && p_four <= 1) {
                      k = (rand() % 16) + 20;
                      } else if (rand_point_work > 6000 && rand_point_work <= 7000 && p_five <= 1) {
                      k = (rand() % 22) + 36;
                      } else if (rand_point_work > 7000 && p_six <=1) {
                      k = (rand() % 9) + 58;
                      } else if (rand_point_work <= 5000 && p_two >=3) {
                      k = (rand() % 12) + 8;
                      } else if (rand_point_work > 5000 && rand_point_work <= 6000 && p_four >= 1) {
                      k = (rand() % 12) + 8;
                      } else if (rand_point_work > 6000 && rand_point_work <= 7000 && p_five >= 1) {
                      k = (rand() % 12) + 8;
                      } else if (rand_point_work > 7000 && p_six >=1) {
                      k = (rand() % 12) + 8;
                      }
                      if (k >= 1 && k <= 2) {
                      rand_point_work += 550;
                      p_one ++;
                      } else if (k >= 3 && k <= 7) {
                      rand_point_work += 100;
                      p_two ++;
                      } else if (k >= 8 && k <= 19) {
                      rand_point_work += 75;
                      } else if (k >= 20 && k <= 35) {
                      rand_point_work -= 3000;
                      p_four ++;
                      } else if (k >= 36 && k <= 57) {
                      rand_point_work -= 3500;
                      p_five ++;
                      } else if (k >= 58 && k <= 66) {
                      rand_point_work -= 4500;
                      p_six ++;
                      }
                      tag[j] = worker[k-1] -> name;
                      j ++;
                      tag[j] = worker[k-1] -> aptitude;
                      j ++;
                      tag[j] = worker[k-1] -> place;
                      j ++;
                      tag[j] = worker[k-1] -> job;
                      j ++;
                      tag[j] = worker[k-1] -> tag_one;
                      j ++;
                      tag[j] = worker[k-1] -> tag_two;
                      j ++;
                      tag[j] = worker[k-1] -> tag_three;
                      j ++;
                      rand_number[i] = k - 1;
                      }
                      string tag_check[5];


                      IP属地:江苏19楼2020-03-28 19:51
                      回复
                        //筛选重要tag作为第一tag显示
                        k = 0;
                        for (i = 0;i < 140;i ++) {
                        if (tag[i] == "高级资深干员") {
                        tag_check[0] = tag[i];
                        k = 1;
                        break;
                        } else if (tag[i] == "资深干员") {
                        tag_check[0] = tag[i];
                        k = 1;
                        break;
                        } else if (tag[i] == "新手") {
                        tag_check[0] = tag[i];
                        k = 1;
                        break;
                        } else if (tag[i] == "支援") {
                        tag_check[0] = tag[i];
                        k = 1;
                        break;
                        } else if (tag[i] == "削弱") {
                        tag_check[0] = tag[i];
                        k = 1;
                        break;
                        } else if (tag[i] == "召唤") {
                        tag_check[0] = tag[i];
                        k = 1;
                        break;
                        } else if (tag[i] == "控场") {
                        tag_check[0] = tag[i];
                        k = 1;
                        break;
                        } else if (tag[i] == "位移") {
                        tag_check[0] = tag[i];
                        k = 1;
                        break;
                        } else if (tag[i] == "快速复活") {
                        tag_check[0] = tag[i];
                        k = 1;
                        break;
                        } else if (tag[i] == "爆发") {
                        tag_check[0] = tag[i];
                        k = 1;
                        break;
                        }
                        }
                        //筛选一般tag作为第一tag显示
                        if (k == 0) {
                        while (true) {
                        i = (rand() % 140);
                        if (tag[i] != "空") {
                        tag_check[0] = tag[i];
                        break;
                        }
                        }
                        }
                        //筛选其余4个tag
                        for (i = 1;i < 5;i ++) {
                        while (true) {
                        j = (rand() % 140);
                        m = 0;
                        if (tag[j] != "空" && ((j % 7) != 0)) {
                        m = 1;
                        }
                        n = 1;
                        for (k = 0;k < i;k ++) {
                        if (tag_check[k] == tag[j]) {
                        n = 0;
                        }
                        }
                        if (m == 1 && n == 1) {
                        tag_check[i] = tag[j];
                        break;
                        }
                        }
                        }


                        IP属地:江苏20楼2020-03-28 19:52
                        回复
                          cout << "以下是5个备选tag:" << endl;
                          for (i = 0;i < 5;i ++) {
                          cout << (i+1) << "." << tag_check[i] << endl;
                          }
                          cout << "请从以上5个备选tag中选出至多3个tag并输入,所选tag不能重复,tag间使用空格、制表符隔开" << endl << "若所选tag不足3个,则其余tag用\"空\"补足" << endl;
                          string tag_a,tag_b,tag_c;
                          while (true) {
                          cin >> tag_a;
                          cin >> tag_b;
                          cin >> tag_c;
                          k = 0;
                          m = 0;
                          n = 0;
                          for (i = 0;i < 5;i ++) {
                          if ((tag_a == "空" || (tag_a != tag_b && tag_a != tag_c)) && (tag_a == tag_check[i] || tag_a == "空")) {
                          k = 1;
                          }
                          }
                          for (i = 0;i < 5;i ++) {
                          if ((tag_b == "空" || (tag_b != tag_a && tag_b != tag_c)) && (tag_b == tag_check[i] || tag_b == "空")) {
                          m = 1;
                          }
                          }
                          for (i = 0;i < 5;i ++) {
                          if ((tag_c == "空" || (tag_c != tag_b && tag_c != tag_a)) && (tag_c == tag_check[i] || tag_c == "空")) {
                          n = 1;
                          }
                          }
                          if (k == 1 && m == 1 && n == 1) {
                          break;
                          } else {
                          cout << "所选tag不符合要求,请从新选取" << endl;
                          }
                          }
                          cout << "请输入招募时间,先输入小时数再输入分钟数,小时与分钟间用空格、制表符隔开(分钟数为10的倍数)" << endl;
                          int hour,minute;
                          cin.clear();
                          cin.ignore(100,'\n');
                          cin >> hour;
                          cin.clear();
                          cin.ignore(100,'\n');
                          cin >> minute;
                          while (true) {
                          i = 0;
                          k = 0;
                          m = 0;
                          if (hour >= 1 && hour <= 9) {
                          i = 1;
                          } else {
                          cout << "输入的小时数不符合要求,请从新输入" << endl;
                          cin.clear();
                          cin.ignore(100,'\n');
                          cin >> hour;
                          }
                          if (minute >= 0 && minute <= 50 && minute % 10 == 0) {
                          k = 1;
                          } else {
                          cout << "输入的分钟数不符合要求,请从新输入" << endl;
                          cin.clear();
                          cin.ignore(100,'\n');
                          cin >> minute;
                          }
                          if (hour == 9 && minute == 0) {
                          m = 1;
                          } else if (hour == 9 && minute != 0) {
                          cout << "输入的分钟数不符合要求,请从新输入" << endl;
                          cin.ignore(100,'\n');
                          cin >> minute;
                          cin >> minute;
                          }
                          if (i == 1 && k ==1) {
                          if (hour == 9 && m == 1){
                          break;
                          } else {
                          break;
                          }
                          }
                          }


                          IP属地:江苏25楼2020-03-28 19:53
                          回复
                            //1:00 - 3:50 1-4星 4:00 - 7 :30 2 - 5星 7:40 - 9:00 3-5星
                            string rand_name[20];
                            int check[20];
                            for (i = 0;i < 20;i ++) {
                            rand_name[i] = tag[i * 7];
                            check[i] = 0;
                            }
                            m = 0;
                            n = 0;
                            for (i = 0;i < 20;i ++) {
                            for (k = 0;k < 7;k ++) {
                            if (tag_a != "空" && tag_a == tag[i * 7 + k] && tag_a != "新手" && tag_a != "机械支援" && hour == 9 && tag[i * 7 + k] != "空") {
                            check[i] += 500;
                            } else if (tag_a != "空" && tag_a == tag[i * 7 + k] && tag_a == "新手" && hour <= 7 && tag[i * 7 + k] != "空") {
                            if (hour == 7 && minute <= 30) {
                            check[i] += 10;
                            } else {
                            check[i] += 10;
                            }
                            } else if (tag_a != "空" && tag_a == tag[i * 7 + k] && tag_a == "新手" && hour > 7 && tag[i * 7 + k] != "空") {
                            check[i] += 0;
                            } else if (tag_a != "空" && tag_a == tag[i * 7 + k] && tag_a == "机械支援" && hour <= 3 && tag[i * 7 + k] != "空") {
                            if (hour == 3 && minute >= 50) {
                            check[i] += 0;
                            } else {
                            check[i] += 10;
                            }
                            } else if (tag_a != "空"&& tag_a == tag[i * 7 + k] && tag_a == "机械支援" && hour > 3 && tag[i * 7 + k] != "空") {
                            check[i] += 0;
                            } else if (tag_a != "空" && tag_a == tag[i * 7 + k] && tag[i * 7 + k] != "空") {
                            check[i] += 1;
                            }
                            }
                            for (k = 0;k < 7;k ++) {
                            if (tag_b != "空" && tag_b == tag[i * 7 + k] && tag_b != "新手" && tag_b != "机械支援" && hour == 9 && tag[i * 7 + k] != "空") {
                            check[i] += 500;
                            } else if (tag_b != "空" && tag_b == tag[i * 7 + k] && tag_b == "新手" && hour <= 7 && tag[i * 7 + k] != "空") {
                            if (hour == 7 && minute <= 30) {
                            check[i] += 10;
                            } else {
                            check[i] += 10;
                            }
                            } else if (tag_b != "空" && tag_b == tag[i * 7 + k] && tag_b == "新手" && hour > 7 && tag[i * 7 + k] != "空") {
                            check[i] += 0;
                            } else if (tag_b != "空" && tag_b == tag[i * 7 + k] && tag_b == "机械支援" && hour <= 3 && tag[i * 7 + k] != "空") {
                            if (hour == 3 && minute >= 50) {
                            check[i] += 0;
                            } else {
                            check[i] += 10;
                            }
                            } else if (tag_b != "空"&& tag_b == tag[i * 7 + k] && tag_b == "机械支援" && hour > 3 && tag[i * 7 + k] != "空") {
                            check[i] += 0;
                            } else if (tag_b != "空" && tag_b == tag[i * 7 + k] && tag[i * 7 + k] != "空") {
                            check[i] += 1;
                            }
                            }
                            for (k = 0;k < 7;k ++) {
                            if (tag_c != "空" && tag_c == tag[i * 7 + k] && tag_c != "新手" && tag_c != "机械支援" && hour == 9 && tag[i * 7 + k] != "空") {
                            check[i] += 500;
                            } else if (tag_c != "空" && tag_c == tag[i * 7 + k] && tag_c == "新手" && hour <= 7 && tag[i * 7 + k] != "空") {
                            if (hour == 7 && minute <= 30) {
                            check[i] += 10;
                            } else {
                            check[i] += 10;
                            }
                            } else if (tag_c != "空" && tag_c == tag[i * 7 + k] && tag_c == "新手" && hour > 7 && tag[i * 7 + k] != "空") {
                            check[i] += 0;
                            } else if (tag_c != "空" && tag_c == tag[i * 7 + k] && tag_c == "机械支援" && hour <= 3 && tag[i * 7 + k] != "空") {
                            if (hour == 3 && minute >= 50) {
                            check[i] += 0;
                            } else {
                            check[i] += 10;
                            }
                            } else if (tag_c != "空"&& tag_c == tag[i * 7 + k] && tag_c == "机械支援" && hour > 3 && tag[i * 7 + k] != "空") {
                            check[i] += 0;
                            } else if (tag_c != "空" && tag_c == tag[i * 7 + k] && tag[i * 7 + k] != "空") {
                            check[i] += 1;
                            }
                            }
                            }
                            //从大到小排序
                            int middle_int;
                            string middle_string;
                            for (i = 0;i < 20;i ++) {
                            for (n = 0;n < 19 - i; n ++) {
                            if (check[n+1] > check[n]) {
                            middle_int = check[n];
                            middle_string = rand_name[n];
                            check[n] = check [n + 1];
                            rand_name[n] =rand_name[n + 1];
                            check [n + 1] = middle_int;
                            rand_name[n + 1] = middle_string;
                            middle_int = rand_number[n];
                            rand_number[n] = rand_number[n + 1];
                            rand_number[n + 1] = middle_int;
                            }
                            }
                            }
                            m = 1;
                            for (i = 1;i < 20;i ++) {
                            k = check[0];
                            if (k == check[i]) {
                            m ++;
                            }
                            }


                            IP属地:江苏27楼2020-03-28 19:54
                            回复
                              k = rand() % m;
                              i = rand_number[k];
                              cout << "已找到符合以下tag的干员" << endl;
                              if (tag_a != "空" && (tag_a == worker[i] -> aptitude || tag_a == worker[i] -> place || tag_a == worker[i] -> job || tag_a == worker[i] -> tag_one || tag_a == worker[i] -> tag_two || tag_a == worker[i] -> tag_three)) {
                              cout << tag_a << "";
                              }
                              if (tag_b != "空" && (tag_b == worker[i] -> aptitude || tag_b == worker[i] -> place || tag_b == worker[i] -> job || tag_b == worker[i] -> tag_one || tag_b == worker[i] -> tag_two || tag_b == worker[i] -> tag_three)) {
                              cout << tag_b << "";
                              }
                              if (tag_c != "空" && (tag_c == worker[i] -> aptitude || tag_c == worker[i] -> place || tag_c == worker[i] -> job || tag_c == worker[i] -> tag_one || tag_c == worker[i] -> tag_two || tag_c == worker[i] -> tag_three)) {
                              cout << tag_c << " ";
                              }
                              cout << endl;
                              cout << "请输入1以继续运行本程序" << endl;
                              cin.clear();
                              cin.ignore(100,'\n');
                              cin >> k;
                              while (true) {
                              if (k == 1) {
                              break;
                              } else {
                              cin.clear();
                              cin.ignore(100,'\n');
                              cout << "输入的数不符合要求,请从新输入" << endl;
                              cin >> k;
                              }
                              }
                              cout << "本次招募的干员是" << endl << worker[i] -> name << endl;
                              if (i >= 0 && i <= 19) {
                              four_star_number ++;
                              }
                              if (i >= 0 && i <= 1) {
                              rand_point += 400;
                              } else if (i >= 2 && i <= 6) {
                              rand_point += 175;
                              } else if (i >= 7 && i <= 18) {
                              rand_point += 100;
                              } else if (i >= 19 && i <= 34 && rand_point >= 1750) {
                              rand_point -= 1000;
                              } else if (i >= 19 && i <= 34 && rand_point <= 1750) {
                              rand_point = 1100;
                              } else if (i >= 35 && i <= 56 && rand_point >= 3250) {
                              rand_point -= 2500;
                              } else if (i >= 35 && i <= 56 && rand_point <= 3250) {
                              rand_point = 1000;
                              } else if (i >= 57 && i <= 65 && rand_point >= 5750) {
                              rand_point -= 5000;
                              } else if (i >= 57 && i <= 65 && rand_point <= 5750) {
                              rand_point = 250;
                              }
                              TiXmlDocument *xml = new TiXmlDocument();
                              xml -> LoadFile(second_filepath);
                              TiXmlElement *root = xml -> RootElement();
                              if (root == NULL) {
                              cout << "请检查arknightslog.xml文件是否正确" << endl;
                              cout << "程序运行时出错" << endl << "输入任意非空格、制表、回车字符以退出程序" << endl;
                              cin >> esc;
                              return 0;
                              }
                              TiXmlElement *first_child_element = root -> FirstChildElement();
                              if (first_child_element == NULL) {
                              cout << "请检查arknightslog.xml文件是否正确" << endl;
                              cout << "程序运行时出错" << endl << "输入任意非空格、制表、回车字符以退出程序" << endl;
                              cin >> esc;
                              return 0;
                              }
                              string srand_result = worker[i] -> name;
                              string _slog_number = first_child_element -> FirstChild() -> Value();
                              stringstream sstr(_slog_number);
                              sstr >> log_number;
                              log_number ++;
                              string srand_point = to_string(rand_point);
                              string slog_number = to_string(log_number);
                              int length;
                              char cslog_number [10];
                              char csrand_point [10];
                              char csrand_result [10];
                              for (i = 0;i < 10;i ++) {
                              cslog_number [i] = NULL;
                              csrand_point [i] = NULL;
                              csrand_result [i] = NULL;
                              }
                              length = slog_number.copy(cslog_number,9);
                              cslog_number [length] = '\0';
                              length = srand_point.copy(csrand_point,9);
                              csrand_point [length] = '\0';
                              length = srand_result.copy(csrand_result,9);
                              csrand_result [length] = '\0';
                              const char *clog_number = cslog_number;
                              const char *crand_point = csrand_point;
                              const char *crand_result = csrand_result;
                              tinyxml.xml_write_result(clog_number,crand_point,crand_result);
                              cout << "已完成一次模拟,以下是两个选项" << endl << "1.继续模拟" << endl << "2.结束运行" << endl;
                              cout << "请从以上两个选项中选择您所期望的那个,并输入其所对应的序号" << endl;
                              m = 0;
                              cin.clear();
                              cin.ignore(100,'\n');
                              cin >> m;
                              while (true) {
                              if (m == 1 || m == 2) {
                              break;
                              } else {
                              cout << "输入的序号不符合要求,请从新输入" << endl;
                              cin.clear();
                              cin.ignore(100,'\n');
                              cin >> m;
                              }
                              }
                              if (m == 2) {
                              cout << "谢谢使用" << endl << "输入任意非空格、制表、回车字符以退出程序" << endl;
                              cin >> esc;
                              return 0;
                              }
                              }
                              return 0;
                              }


                              IP属地:江苏29楼2020-03-28 19:54
                              回复