zoukankan      html  css  js  c++  java
  • vector <struct> 使用

    #include <iostream>
    #include <vector>
    using namespace std;

    struct NODE
    {
     int m_nRoleID;
     int m_nScore;
     string m_strROleName;
     NODE() :
      m_nRoleID(1), m_nScore(0),m_strROleName("byfei")
     {
     }
     NODE(const int nRoleID, const int nScore,const string strRoleName) :
      m_nRoleID(nRoleID), m_nScore(nScore),m_strROleName(strRoleName)
     {
     }
    };

    vector<NODE> v;

    int main()
    {
     for (uint i = 0; i < 10; i++)
      v.push_back(NODE());
     for (uint i = 0; i < v.size(); i++)
     {
      v[i].m_nRoleID = 2;
      v[i].m_nScore = 1;
      v[i].m_strROleName = "byf";
      cout << v[i].m_nRoleID << " " << v[i].m_nScore <<" "<< v[i].m_strROleName << endl;
     }
     getchar();
     return 0;
    }

  • 相关阅读:
    感想2
    感想1
    记录4
    记录3
    记录2
    记录1
    库存物资管理系统-测试
    开学测试
    大二下开学测试有感
    大二下周总结一
  • 原文地址:https://www.cnblogs.com/byfei/p/3112330.html
Copyright © 2011-2022 走看看