zoukankan      html  css  js  c++  java
  • map Insert Remove

     

    #ifndef CBIGBOSS_H_
    #define CBIGBOSS_H_

    #include <time.h>
    #include <map>
    using namespace std;
    class CBigBoss {
    public:
     typedef map<int, int> templatemap;
     templatemap BossSort;
     bool Insert(int nRoleID,int nHurtBlood);

    bool Updata(int nRoleID,int nHurtBlood);
     bool Remove(int nRoleID);

    }

    #endif

    bool CBigBoss::Insert(int nRoleID,int nHurtBlood)
    {
     if(BossSort.find(nRoleID)!= BossSort.end())
       return false;
     BossSort[nRoleID] = nHurtBlood;
     return true;
    }

    bool CBigBoss::Updata(int nRoleID,int nHurtBlood)
    {
     templatemap::iterator iter = BossSort.find(nRoleID);
     if (iter == BossSort.end())
      return false;
     BossSort[nRoleID] = nHurtBlood;
     return true;
    }

    bool CBigBoss::Remove(int nRoleID)
    {
     templatemap::iterator iter = BossSort.find(nRoleID);
     if (iter == BossSort.end())
      return false;
     BossSort.erase(iter);
     return true;
    }

  • 相关阅读:
    创建HttpFilter与理解多个Filter代码的执行顺序
    Filter
    JSTL
    EL
    JavaBean
    HttpSession之表单的重复提交 & 验证码
    相对路径和绝对路径
    HttpSession之简易购物车
    HttpSession
    Cookie
  • 原文地址:https://www.cnblogs.com/byfei/p/3112276.html
Copyright © 2011-2022 走看看