21xrx.com
2025-03-27 03:56:31 Thursday
文章检索 我的文章 写文章
C++编写党员发展简易管理系统代码
2023-07-06 03:33:39 深夜i     --     --
C++ 党员发展 管理系统 代码

随着信息化时代的到来,不少组织都开始注重信息化和数字化建设,党员发展简易管理系统也不例外。本文将介绍使用C++编写党员发展简易管理系统的相关代码。

首先,我们需要知道系统的基本功能,包括人员管理、培训管理、考核管理等内容。接下来,我们就来看看这些功能的代码实现。

1. 人员管理

人员管理应包括新党员登记、党员信息查询、党员信息修改等功能。下面是新党员登记的代码:

struct member
  string name;      // 姓名
  int age;        // 年龄
  string sex;      // 性别
  string phone_number;  // 手机号
  string id;       // 身份证号
  string apply_time;   // 入党申请时间
  string party_branch;  // 所在党支部
;
// 新党员登记
void new_member()
{
  member new_m;
  cout << "请输入党员的姓名:";
  getline(cin, new_m.name);
  cout << "请输入党员的年龄:";
  cin >> new_m.age;
  cout << "请输入党员的性别:";
  cin >> new_m.sex;
  cout << "请输入党员的手机号:";
  cin >> new_m.phone_number;
  cout << "请输入党员的身份证号:";
  cin >> new_m.id;
  cout << "请输入党员的入党申请时间:";
  cin >> new_m.apply_time;
  cout << "请输入党员的所在党支部:";
  cin >> new_m.party_branch;
  // 将新党员信息写入文件
  ofstream outfile("member.txt", ios::app); // 因为需要追加,所以使用ios::app
  outfile << new_m.name << " " << new_m.age << " " << new_m.sex << " "
      << new_m.phone_number << " " << new_m.id << " " << new_m.apply_time << " "
      << new_m.party_branch << endl;
  outfile.close();
}

2. 培训管理

培训管理包括培训计划制定、培训记录查询等功能。下面是培训计划制定的代码:

struct training_plan
  string plan_name;  // 培训计划名称
  string start_time; // 开始时间
  string end_time;  // 结束时间
  string content;   // 培训内容
;
// 培训计划制定
void make_training_plan()
{
  training_plan tp;
  cout << "请输入培训计划名称:";
  getline(cin, tp.plan_name);
  cout << "请输入开始时间(xxxx-xx-xx):";
  cin >> tp.start_time;
  cout << "请输入结束时间(xxxx-xx-xx):";
  cin >> tp.end_time;
  cout << "请输入培训内容:";
  getline(cin, tp.content);
  // 将培训计划写入文件
  ofstream outfile("training_plan.txt", ios::app);
  outfile << tp.plan_name << " " << tp.start_time << " " << tp.end_time << " "
      << tp.content << endl;
  outfile.close();
}

3. 考核管理

考核管理包括党员年度考核、党员活动考核等功能。下面是党员年度考核的代码:

struct annual_assessment
  string name;      // 姓名
  float personal_score; // 个人得分
  float team_score;   // 团队得分
  float total_score;   // 总得分
;
// 党员年度考核
void annual_assess()
{
  string name;
  cout << "请输入需要考核的党员姓名:";
  getline(cin, name);
  // 从文件中读取党员信息进行考核
  ifstream infile("member.txt");
  string line;
  bool is_found = false;
  while (getline(infile, line))
  {
    stringstream ss(line);
    member m;
    ss >> m.name >> m.age >> m.sex >> m.phone_number >> m.id >> m.apply_time >> m.party_branch;
    if (m.name == name) // 找到该党员信息后进行考核
    {
      is_found = true;
      annual_assessment aa;
      aa.name = name;
      cout << "请输入个人得分:";
      cin >> aa.personal_score;
      cout << "请输入团队得分:";
      cin >> aa.team_score;
      aa.total_score = aa.personal_score + aa.team_score;
      // 将考核结果写入文件
      ofstream outfile("annual_assessment.txt", ios::app);
      outfile << aa.name << " " << aa.personal_score << " " << aa.team_score << " "
          << aa.total_score << endl;
      outfile.close();
      cout << "考核结束,考核结果已保存。" << endl;
      break;
    }
  }
  if (!is_found)
  
    cout << "未找到该党员信息。" << endl;
  
  infile.close();
}

以上就是党员发展简易管理系统代码的相关内容。实际上,这只是一个简单的示例,实际情况中还会有更多功能和细节需要考虑。总之,C++编写党员发展简易管理系统代码可以更好地帮助组织管理党员信息和党员发展进程。

  
  

评论区