8组_校园社团活动发布与报名系统:基于 C++ 的校园社团活动管理系统项目

可用于校园内社团活动的发布、报名及管理,支持管理员、社团负责人和学生三种角色,具备活动发布、报名审核、评论互动、数据统计等核心功能。【此简介由AI生成】

Branch1Tags0
FilesLast commitLast update
5 months ago

#include <conio.h> #include #include #include #include #include #include #include #include <windows.h>

using namespace std;

#define MAX_ACTIVITY 200 #define MAX_STUDENT 500 #define MAX_CLUB 100 #define MAX_APPLY 800 #define MAX_LOG 1000 #define MAX_NOTICE 100 #define MAX_COMMENT 200 #define ADMIN_NAME "admin" #define ADMIN_PWD "123456"

// 日志类 class SystemLog { public: char time[50]; char type[20]; char content[150]; };

// 公告类 class Notice { public: char noticeId[20]; char title[50]; char content[200]; char publishTime[30]; char publisher[20]; int status; };

// 评论类 class Comment { public: char comId[20]; char actId[20]; char stuId[20]; char stuName[20]; char content[150]; char comTime[30]; int status; };

// 学生类 class Student { public: char stuId[20]; char stuName[20]; char stuPwd[20]; char className[30]; char phone[20]; char email[30]; char sex[10]; int age; char major[50]; int status; };

// 社团类 class Club { public: char clubId[20]; char clubName[30]; char chargeId[20]; char chargeName[20]; char createTime[30]; char clubIntro[300]; char clubType[30]; int memberNum; int status; };

// 活动类 class Activity { public: char actId[20]; char actName[50]; char clubId[20]; char clubName[30]; char actTime[50]; char actPlace[50]; int maxNum; int nowNum; int status; char actIntro[300]; char publishTime[30]; char actType[30]; int score; int commentCount; };

// 报名记录类 class Apply { public: char applyId[20]; char actId[20]; char stuId[20]; char stuName[20]; char applyTime[30]; int status; char checkInTime[30]; int isCheckIn; };

// 全局对象数组 Student stuList[MAX_STUDENT]; Club clubList[MAX_CLUB]; Activity actList[MAX_ACTIVITY]; Apply applyList[MAX_APPLY]; SystemLog logList[MAX_LOG]; Notice noticeList[MAX_NOTICE]; Comment commentList[MAX_COMMENT];

int stuCount = 0; int clubCount = 0; int actCount = 0; int applyCount = 0; int logCount = 0; int noticeCount = 0; int commentCount = 0;

char currentStuId[20]; char currentClubId[20];

// 函数声明 void menu(); void adminMenu(); void clubMenu(); void stuMenu();

void loadData(); void saveData(); void loadLog(); void saveLog(); void loadNotice(); void saveNotice(); void loadComment(); void saveComment();

void writeLog(const char *type, const char *content); void adminLogin(); void stuLogin(); void clubLogin(); void stuRegister();

void addClub(); void showAllClub(); void modifyClub(); void deleteClub(); void searchClub(); void showClubMember(); void addClubMember(); void deleteClubMember();

void addActivity(); void checkActivity(); void showAllActivity(); void showMyClubActivity(); void modifyActivity(); void deleteActivity(); void searchActivity(); void activityScore(); void activityComment(); void showActivityComment();

void applyActivity(); void cancelApply(); void showMyApply(); void checkInApply(); void statisticsApply(); void showApplyByAct(); void exportApplyData();

void modifyStuInfo(); void showStuInfo(); void resetStuPwd(); void disableStu(); void enableStu(); void searchStu();

void showClubDetail(); void statisticsActivity(); void statisticsClub(); void showSystemLog(); void clearSystemLog();

void publishNotice(); void showAllNotice(); void deleteNotice(); void modifyNotice();

void initSystem(); void exitSystem(); void clearScreen(); void pauseSystem(); void welcomeAnimation(); void loadingAnimation();

char *getCurrentTime(); int isStuExist(const char *stuId); int isClubExist(const char *clubId); int isActExist(const char *actId); int isApplied(const char *stuId, const char *actId); int isClubMember(const char *clubId, const char *stuId); int isNoticeExist(const char *noticeId); int isValidPhone(const char *phone); int isValidEmail(const char *email); void checkApplyStatus();

// 主函数 int main() { initSystem(); welcomeAnimation(); loadData(); loadLog(); loadNotice(); loadComment(); menu(); saveData(); saveLog(); saveNotice(); saveComment(); return 0; }

// 系统初始化 void initSystem() { ofstream fout; fout.open("student.txt", ios::app); fout.close(); fout.open("club.txt", ios::app); fout.close(); fout.open("activity.txt", ios::app); fout.close(); fout.open("apply.txt", ios::app); fout.close(); fout.open("log.txt", ios::app); fout.close(); fout.open("notice.txt", ios::app); fout.close(); fout.open("comment.txt", ios::app); fout.close();

system("color 0A");
clearScreen();
writeLog("系统", "系统启动成功");

}

// 欢迎动画 void welcomeAnimation() { clearScreen(); cout << "\n\n\n\n"; cout << "\t\t=============================================" << endl; cout << "\t\t 校园社团活动发布与报名系统 V3.0 " << endl; cout << "\t\t=============================================" << endl; cout << "\n\n\t\t"; for (int i = 0; i < 20; i++) { cout << "■"; Sleep(50); } cout << "\n\n\t\t 系统初始化完成,欢迎使用! " << endl; Sleep(1000); pauseSystem(); }

// 加载动画 void loadingAnimation() { cout << "\n正在加载数据"; for (int i = 0; i < 10; i++) { cout << "."; Sleep(200); } cout << " 完成!\n"; Sleep(500); }

// 获取当前系统时间 char *getCurrentTime() { static char curTime[50]; time_t now = time(0); tm *ltm = localtime(&now); sprintf(curTime, "%04d-%02d-%02d %02d:%02d:%02d", 1900 + ltm->tm_year, 1 + ltm->tm_mon, ltm->tm_mday, ltm->tm_hour, ltm->tm_min, ltm->tm_sec); return curTime; }

// 清屏函数 void clearScreen() { system("cls"); }

// 暂停函数 void pauseSystem() { cout << "\n按任意键继续..."; _getch(); }

// 手机号验证 int isValidPhone(const char *phone) { if (strlen(phone) != 11) return 0; for (int i = 0; i < 11; i++) { if (phone[i] < '0' || phone[i] > '9') return 0; } return 1; }

// 邮箱验证 int isValidEmail(const char *email) { char *at = strchr((char *)email, '@'); char *dot = strchr((char *)email, '.'); if (at == NULL || dot == NULL) return 0; if (at > dot) return 0; return 1; }

// 写入日志 void writeLog(const char *type, const char *content) { if (logCount >= MAX_LOG) return; strcpy(logList[logCount].time, getCurrentTime()); strcpy(logList[logCount].type, type); strcpy(logList[logCount].content, content); logCount++; }

// 加载日志 void loadLog() { ifstream fin("log.txt"); logCount = 0; while (fin >> logList[logCount].time >> logList[logCount].type) { fin.ignore(); fin.getline(logList[logCount].content, 150); logCount++; } fin.close(); }

// 保存日志 void saveLog() { ofstream fout("log.txt"); for (int i = 0; i < logCount; i++) { fout << logList[i].time << " " << logList[i].type << " " << logList[i].content << endl; } fout.close(); }

// 加载公告 void loadNotice() { ifstream fin("notice.txt"); noticeCount = 0; while (fin >> noticeList[noticeCount].noticeId >> noticeList[noticeCount].title >> noticeList[noticeCount].publishTime >> noticeList[noticeCount].publisher >> noticeList[noticeCount].status) { fin.ignore(); fin.getline(noticeList[noticeCount].content, 200); noticeCount++; } fin.close(); }

// 保存公告 void saveNotice() { ofstream fout("notice.txt"); for (int i = 0; i < noticeCount; i++) { fout << noticeList[i].noticeId << " " << noticeList[i].title << " " << noticeList[i].publishTime << " " << noticeList[i].publisher << " " << noticeList[i].status << endl; fout << noticeList[i].content << endl; } fout.close(); }

// 加载评论 void loadComment() { ifstream fin("comment.txt"); commentCount = 0; while (fin >> commentList[commentCount].comId >> commentList[commentCount].actId >> commentList[commentCount].stuId >> commentList[commentCount].stuName >> commentList[commentCount].comTime >> commentList[commentCount].status) { fin.ignore(); fin.getline(commentList[commentCount].content, 150); commentCount++; } fin.close(); }

// 保存评论 void saveComment() { ofstream fout("comment.txt"); for (int i = 0; i < commentCount; i++) { fout << commentList[i].comId << " " << commentList[i].actId << " " << commentList[i].stuId << " " << commentList[i].stuName << " " << commentList[i].comTime << " " << commentList[i].status << endl; fout << commentList[i].content << endl; } fout.close(); }

// 校验学生是否存在 int isStuExist(const char *stuId) { for (int i = 0; i < stuCount; i++) { if (strcmp(stuList[i].stuId, stuId) == 0) { return i; } } return -1; }

// 校验社团是否存在 int isClubExist(const char *clubId) { for (int i = 0; i < clubCount; i++) { if (strcmp(clubList[i].clubId, clubId) == 0) { return i; } } return -1; }

// 校验活动是否存在 int isActExist(const char *actId) { for (int i = 0; i < actCount; i++) { if (strcmp(actList[i].actId, actId) == 0) { return i; } } return -1; }

// 校验是否已报名 int isApplied(const char *stuId, const char *actId) { for (int i = 0; i < applyCount; i++) { if (strcmp(applyList[i].stuId, stuId) == 0 && strcmp(applyList[i].actId, actId) == 0 && applyList[i].status == 1) { return 1; } } return 0; }

// 校验社团成员 int isClubMember(const char *clubId, const char *stuId) { char filename[50]; sprintf(filename, "club_member_%s.txt", clubId); ifstream fin(filename); if (!fin) return 0; char id[20]; while (fin >> id) { if (strcmp(id, stuId) == 0) { fin.close(); return 1; } } fin.close(); return 0; }

// 校验公告 int isNoticeExist(const char *noticeId) { for (int i = 0; i < noticeCount; i++) { if (strcmp(noticeList[i].noticeId, noticeId) == 0) { return i; } } return -1; }

// 加载所有数据 void loadData() { clearScreen(); loadingAnimation();

ifstream fin("student.txt");
stuCount = 0;
while (fin >> stuList[stuCount].stuId >> stuList[stuCount].stuName >>
       stuList[stuCount].stuPwd >> stuList[stuCount].className >>
       stuList[stuCount].phone >> stuList[stuCount].email >>
       stuList[stuCount].sex >> stuList[stuCount].age >>
       stuList[stuCount].major >> stuList[stuCount].status) {
    stuCount++;
}
fin.close();

fin.open("club.txt");
clubCount = 0;
while (fin >> clubList[clubCount].clubId >> clubList[clubCount].clubName >>
       clubList[clubCount].chargeId >> clubList[clubCount].chargeName >>
       clubList[clubCount].createTime >> clubList[clubCount].clubType >>
       clubList[clubCount].memberNum >> clubList[clubCount].status) {
    fin.ignore();
    fin.getline(clubList[clubCount].clubIntro, 300);
    clubCount++;
}
fin.close();

fin.open("activity.txt");
actCount = 0;
while (fin >> actList[actCount].actId >> actList[actCount].actName >>
       actList[actCount].clubId >> actList[actCount].clubName >>
       actList[actCount].actTime >> actList[actCount].actPlace >>
       actList[actCount].maxNum >> actList[actCount].nowNum >>
       actList[actCount].status >> actList[actCount].publishTime >>
       actList[actCount].actType >> actList[actCount].score >>
       actList[actCount].commentCount) {
    fin.ignore();
    fin.getline(actList[actCount].actIntro, 300);
    actCount++;
}
fin.close();

fin.open("apply.txt");
applyCount = 0;
while (fin >> applyList[applyCount].applyId >> applyList[applyCount].actId >>
       applyList[applyCount].stuId >> applyList[applyCount].stuName >>
       applyList[applyCount].applyTime >> applyList[applyCount].status >>
       applyList[applyCount].isCheckIn) {
    fin.ignore();
    fin.getline(applyList[applyCount].checkInTime, 30);
    applyCount++;
}
fin.close();

cout << "数据加载完成!学生:" << stuCount << " 社团:" << clubCount
     << " 活动:" << actCount << " 报名:" << applyCount << endl;
Sleep(1000);

}

// 保存所有数据 void saveData() { ofstream fout("student.txt"); for (int i = 0; i < stuCount; i++) { fout << stuList[i].stuId << " " << stuList[i].stuName << " " << stuList[i].stuPwd << " " << stuList[i].className << " " << stuList[i].phone << " " << stuList[i].email << " " << stuList[i].sex << " " << stuList[i].age << " " << stuList[i].major << " " << stuList[i].status << endl; } fout.close();

fout.open("club.txt");
for (int i = 0; i < clubCount; i++) {
    fout << clubList[i].clubId << " " << clubList[i].clubName << " "
         << clubList[i].chargeId << " " << clubList[i].chargeName << " "
         << clubList[i].createTime << " " << clubList[i].clubType << " "
         << clubList[i].memberNum << " " << clubList[i].status << endl;
    fout << clubList[i].clubIntro << endl;
}
fout.close();

fout.open("activity.txt");
for (int i = 0; i < actCount; i++) {
    fout << actList[i].actId << " " << actList[i].actName << " "
         << actList[i].clubId << " " << actList[i].clubName << " "
         << actList[i].actTime << " " << actList[i].actPlace << " "
         << actList[i].maxNum << " " << actList[i].nowNum << " "
         << actList[i].status << " " << actList[i].publishTime << " "
         << actList[i].actType << " " << actList[i].score << " "
         << actList[i].commentCount << endl;
    fout << actList[i].actIntro << endl;
}
fout.close();

fout.open("apply.txt");
for (int i = 0; i < applyCount; i++) {
    fout << applyList[i].applyId << " " << applyList[i].actId << " "
         << applyList[i].stuId << " " << applyList[i].stuName << " "
         << applyList[i].applyTime << " " << applyList[i].status << " "
         << applyList[i].isCheckIn << endl;
    fout << applyList[i].checkInTime << endl;
}
fout.close();

}

// 主菜单 void menu() { int choice; while (true) { clearScreen(); cout << "=============================================" << endl; cout << " 校园社团活动发布与报名系统 V3.0 " << endl; cout << "=============================================" << endl; cout << " 1. 管理员登录 " << endl; cout << " 2. 社团负责人登录 " << endl; cout << " 3. 学生登录 " << endl; cout << " 4. 学生注册 " << endl; cout << " 5. 查看系统公告 " << endl; cout << " 0. 退出系统 " << endl; cout << "=============================================" << endl; cout << "请输入您的选择:"; cin >> choice;

    switch (choice) {
    case 1:
        adminLogin();
        break;
    case 2:
        clubLogin();
        break;
    case 3:
        stuLogin();
        break;
    case 4:
        stuRegister();
        break;
    case 5:
        showAllNotice();
        break;
    case 0:
        exitSystem();
        return;
    default:
        cout << "输入错误,请重新选择!" << endl;
        pauseSystem();
    }
}

}

// 退出系统 void exitSystem() { clearScreen(); saveData(); saveLog(); saveNotice(); saveComment(); cout << "=============================================" << endl; cout << " 数据已保存,感谢使用系统! " << endl; cout << "=============================================" << endl; writeLog("系统", "用户退出系统"); pauseSystem(); }

// 管理员登录 void adminLogin() { char id[20], pwd[20]; clearScreen(); cout << "========== 管理员登录 ==========" << endl; cout << "请输入管理员账号:"; cin >> id; cout << "请输入管理员密码:"; cin >> pwd;

if (strcmp(id, ADMIN_NAME) == 0 && strcmp(pwd, ADMIN_PWD) == 0) {
    cout << "登录成功!欢迎您,超级管理员!" << endl;
    writeLog("管理员", "管理员登录系统");
    pauseSystem();
    adminMenu();
} else {
    cout << "账号或密码错误,登录失败!" << endl;
    writeLog("安全", "管理员登录失败");
    pauseSystem();
}

}

// 学生注册 void stuRegister() { clearScreen(); cout << "========== 学生注册 ==========" << endl; Student s;

cout << "请输入学号:";
cin >> s.stuId;
if (isStuExist(s.stuId) != -1) {
    cout << "该学号已被注册!" << endl;
    pauseSystem();
    return;
}

cout << "请输入姓名:";
cin >> s.stuName;
cout << "请输入密码:";
cin >> s.stuPwd;
cout << "请输入班级:";
cin >> s.className;

cout << "请输入手机号:";
cin >> s.phone;
while (!isValidPhone(s.phone)) {
    cout << "手机号格式错误!重新输入:";
    cin >> s.phone;
}

cout << "请输入邮箱:";
cin >> s.email;
while (!isValidEmail(s.email)) {
    cout << "邮箱格式错误!重新输入:";
    cin >> s.email;
}

cout << "请输入性别:";
cin >> s.sex;
cout << "请输入年龄:";
cin >> s.age;
cout << "请输入专业:";
cin >> s.major;
s.status = 1;

stuList[stuCount++] = s;
cout << "注册成功!请返回登录!" << endl;
char logBuf[200];
sprintf(logBuf, "%s 注册账号", s.stuId);
writeLog("学生", logBuf);
pauseSystem();

}

// 学生登录 void stuLogin() { char id[20], pwd[20]; clearScreen(); cout << "========== 学生登录 ==========" << endl; cout << "请输入学号:"; cin >> id; cout << "请输入密码:"; cin >> pwd;

int index = isStuExist(id);
if (index != -1 && strcmp(stuList[index].stuPwd, pwd) == 0) {
    if (stuList[index].status == 0) {
        cout << "账号已被禁用,请联系管理员!" << endl;
        pauseSystem();
        return;
    }
    strcpy(currentStuId, id);
    cout << "登录成功!欢迎您," << stuList[index].stuName << "同学!" << endl;
    char logBuf[200];
    sprintf(logBuf, "%s 登录系统", id);
    writeLog("学生", logBuf);
    pauseSystem();
    stuMenu();
    return;
}
cout << "学号或密码错误!" << endl;
pauseSystem();

}

// 社团负责人登录 void clubLogin() { char id[20], pwd[20]; clearScreen(); cout << "========== 社团负责人登录 ==========" << endl; cout << "请输入负责人学号:"; cin >> id; cout << "请输入密码:"; cin >> pwd;

int stuIdx = isStuExist(id);
if (stuIdx == -1 || strcmp(stuList[stuIdx].stuPwd, pwd) != 0) {
    cout << "学生信息验证失败!" << endl;
    pauseSystem();
    return;
}

for (int i = 0; i < clubCount; i++) {
    if (strcmp(clubList[i].chargeId, id) == 0 && clubList[i].status == 1) {
        strcpy(currentClubId, clubList[i].clubId);
        cout << "登录成功!欢迎您," << stuList[stuIdx].stuName << "负责人!"
             << endl;
        char logBuf[200];
        sprintf(logBuf, "%s 负责人登录", id);
        writeLog("社团", logBuf);
        pauseSystem();
        clubMenu();
        return;
    }
}

cout << "您不是任何社团的负责人!" << endl;
pauseSystem();

}

// 管理员菜单 void adminMenu() { int choice; while (true) { clearScreen(); cout << "=============================================" << endl; cout << " 管理员功能菜单 " << endl; cout << "=============================================" << endl; cout << " 【社团管理】 1.添加社团 2.查看社团 3.修改社团 4.注销社团 " "5.搜索社团 " << endl; cout << " 【活动管理】 6.审核活动 7.查看活动 8.删除活动 9.活动统计 " "10.查看报名 " << endl; cout << " 【学生管理】11.查看学生 12.重置密码 13.禁用学生 14.启用学生 " "15.搜索学生 " << endl; cout << " 【公告管理】16.发布公告 17.查看公告 18.删除公告 19.修改公告 " << endl; cout << " 【系统管理】20.系统日志 21.清空日志 22.社团统计 23.导出数据 " "0.返回主菜单 " << endl; cout << "=============================================" << endl; cout << "请输入选择:"; cin >> choice;

    switch (choice) {
    case 1:
        addClub();
        break;
    case 2:
        showAllClub();
        break;
    case 3:
        modifyClub();
        break;
    case 4:
        deleteClub();
        break;
    case 5:
        searchClub();
        break;
    case 6:
        checkActivity();
        break;
    case 7:
        showAllActivity();
        break;
    case 8:
        deleteActivity();
        break;
    case 9:
        statisticsActivity();
        break;
    case 10:
        showApplyByAct();
        break;
    case 11:
        showStuInfo();
        break;
    case 12:
        resetStuPwd();
        break;
    case 13:
        disableStu();
        break;
    case 14:
        enableStu();
        break;
    case 15:
        searchStu();
        break;
    case 16:
        publishNotice();
        break;
    case 17:
        showAllNotice();
        break;
    case 18:
        deleteNotice();
        break;
    case 19:
        modifyNotice();
        break;
    case 20:
        showSystemLog();
        break;
    case 21:
        clearSystemLog();
        break;
    case 22:
        statisticsClub();
        break;
    case 23:
        exportApplyData();
        break;
    case 0:
        return;
    default:
        cout << "输入错误!" << endl;
        pauseSystem();
    }
}

}

// 添加社团 void addClub() { clearScreen(); cout << "========== 添加社团 ==========" << endl; Club c;

cout << "请输入社团编号:";
cin >> c.clubId;
if (isClubExist(c.clubId) != -1) {
    cout << "社团编号已存在!" << endl;
    pauseSystem();
    return;
}

cout << "请输入社团名称:";
cin >> c.clubName;
cout << "请输入社团类型:";
cin >> c.clubType;
cout << "请输入负责人学号:";
cin >> c.chargeId;

int stuIdx = isStuExist(c.chargeId);
if (stuIdx == -1) {
    cout << "该学生不存在!" << endl;
    pauseSystem();
    return;
}
strcpy(c.chargeName, stuList[stuIdx].stuName);
strcpy(c.createTime, getCurrentTime());
c.status = 1;
c.memberNum = 1;

cout << "请输入社团简介:";
cin.ignore();
cin.getline(c.clubIntro, 300);

clubList[clubCount++] = c;

char filename[50];
sprintf(filename, "club_member_%s.txt", c.clubId);
ofstream fout(filename);
fout << c.chargeId << endl;
fout.close();

cout << "社团添加成功!" << endl;
char logBuf[200];
sprintf(logBuf, "添加社团:%s", c.clubName);
writeLog("管理员", logBuf);
pauseSystem();

}

// 查看所有社团 void showAllClub() { clearScreen(); cout << "============================================= 所有社团信息 " "=============================================" << endl; cout << left << setw(15) << "社团编号" << setw(20) << "社团名称" << setw(15) << "社团类型" << setw(15) << "负责人" << setw(15) << "成员数" << setw(20) << "创建时间" << setw(10) << "状态" << endl; cout << "====================================================================" "================================" << endl;

for (int i = 0; i < clubCount; i++) {
    cout << left << setw(15) << clubList[i].clubId << setw(20)
         << clubList[i].clubName << setw(15) << clubList[i].clubType << setw(15)
         << clubList[i].chargeName << setw(15) << clubList[i].memberNum
         << setw(20) << clubList[i].createTime << setw(10)
         << (clubList[i].status == 1 ? "正常" : "已注销") << endl;
}
pauseSystem();

}

// 修改社团 void modifyClub() { clearScreen(); showAllClub(); char id[20]; cout << "请输入要修改的社团编号:"; cin >> id;

int idx = isClubExist(id);
if (idx == -1) {
    cout << "社团不存在!" << endl;
    pauseSystem();
    return;
}

cout << "请输入新社团名称:";
cin >> clubList[idx].clubName;
cout << "请输入新社团类型:";
cin >> clubList[idx].clubType;
cout << "请输入新负责人学号:";
cin >> clubList[idx].chargeId;

int stuIdx = isStuExist(clubList[idx].chargeId);
if (stuIdx != -1) {
    strcpy(clubList[idx].chargeName, stuList[stuIdx].stuName);
}

cout << "请输入新社团简介:";
cin.ignore();
cin.getline(clubList[idx].clubIntro, 300);

cout << "修改成功!" << endl;
char logBuf[200];
sprintf(logBuf, "修改社团:%s", id);
writeLog("管理员", logBuf);
pauseSystem();

}

// 注销社团 void deleteClub() { clearScreen(); showAllClub(); char id[20]; cout << "请输入要注销的社团编号:"; cin >> id;

int idx = isClubExist(id);
if (idx == -1) {
    cout << "社团不存在!" << endl;
    pauseSystem();
    return;
}

clubList[idx].status = 0;
cout << "社团注销成功!" << endl;
char logBuf[200];
sprintf(logBuf, "注销社团:%s", id);
writeLog("管理员", logBuf);
pauseSystem();

}

// 搜索社团 void searchClub() { clearScreen(); char key[30]; cout << "请输入社团名称/编号关键词:"; cin >> key;

cout << "\n搜索结果:\n";
bool flag = false;
for (int i = 0; i < clubCount; i++) {
    if (strstr(clubList[i].clubName, key) != NULL ||
        strstr(clubList[i].clubId, key) != NULL) {
        flag = true;
        cout << "编号:" << clubList[i].clubId << " 名称:"
             << clubList[i].clubName << " 类型:" << clubList[i].clubType
             << " 负责人:" << clubList[i].chargeName << endl;
    }
}
if (!flag)
    cout << "未找到相关社团!" << endl;
pauseSystem();

}

// 审核活动 void checkActivity() { clearScreen(); cout << "========== 待审核活动 ==========" << endl; int num = 0; for (int i = 0; i < actCount; i++) { if (actList[i].status == 0) { num++; cout << num << ". 活动编号:" << actList[i].actId << " 名称:" << actList[i].actName << endl; } }

if (num == 0) {
    cout << "暂无待审核活动!" << endl;
    pauseSystem();
    return;
}

char actId[20];
cout << "请输入活动编号:";
cin >> actId;

int idx = isActExist(actId);
if (idx == -1 || actList[idx].status != 0) {
    cout << "活动不存在或非待审核!" << endl;
    pauseSystem();
    return;
}

int c;
cout << "1. 通过  2. 不通过:";
cin >> c;
if (c == 1)
    actList[idx].status = 1;
else if (c == 2)
    actList[idx].status = 2;
cout << "审核完成!" << endl;
char logBuf[200];
sprintf(logBuf, "审核活动:%s", actId);
writeLog("管理员", logBuf);
pauseSystem();

}

// 删除活动 void deleteActivity() { clearScreen(); showAllActivity(); char id[20]; cout << "输入要删除的活动编号:"; cin >> id;

int idx = isActExist(id);
if (idx == -1) {
    cout << "活动不存在!" << endl;
    pauseSystem();
    return;
}

for (int i = idx; i < actCount - 1; i++)
    actList[i] = actList[i + 1];
actCount--;

for (int i = 0; i < applyCount; i++) {
    if (strcmp(applyList[i].actId, id) == 0) {
        for (int j = i; j < applyCount - 1; j++)
            applyList[j] = applyList[j + 1];
        applyCount--;
        i--;
    }
}

cout << "活动及报名记录删除成功!" << endl;
char logBuf[200];
sprintf(logBuf, "删除活动:%s", id);
writeLog("管理员", logBuf);
pauseSystem();

}

// 查看学生信息 void showStuInfo() { clearScreen(); cout << "============================================= 学生信息 " "=============================================" << endl; cout << left << setw(15) << "学号" << setw(10) << "姓名" << setw(10) << "性别" << setw(15) << "班级" << setw(15) << "专业" << setw(15) << "手机" << setw(10) << "状态" << endl;

for (int i = 0; i < stuCount; i++) {
    cout << left << setw(15) << stuList[i].stuId << setw(10)
         << stuList[i].stuName << setw(10) << stuList[i].sex << setw(15)
         << stuList[i].className << setw(15) << stuList[i].major << setw(15)
         << stuList[i].phone << setw(10)
         << (stuList[i].status == 1 ? "正常" : "禁用") << endl;
}
pauseSystem();

}

// 重置学生密码 void resetStuPwd() { clearScreen(); char id[20]; cout << "请输入学生学号:"; cin >> id;

int idx = isStuExist(id);
if (idx == -1) {
    cout << "学生不存在!" << endl;
    pauseSystem();
    return;
}

strcpy(stuList[idx].stuPwd, "123456");
cout << "密码已重置为:123456" << endl;
char logBuf[200];
sprintf(logBuf, "重置密码:%s", id);
writeLog("管理员", logBuf);
pauseSystem();

}

// 禁用学生 void disableStu() { clearScreen(); char id[20]; cout << "请输入要禁用的学生学号:"; cin >> id; int idx = isStuExist(id); if (idx == -1) { cout << "学生不存在!" << endl; pauseSystem(); return; } stuList[idx].status = 0; cout << "学生禁用成功!" << endl; char logBuf[200]; sprintf(logBuf, "禁用学生:%s", id); writeLog("管理员", logBuf); pauseSystem(); }

// 启用学生 void enableStu() { clearScreen(); char id[20]; cout << "请输入要启用的学生学号:"; cin >> id; int idx = isStuExist(id); if (idx == -1) { cout << "学生不存在!" << endl; pauseSystem(); return; } stuList[idx].status = 1; cout << "学生启用成功!" << endl; char logBuf[200]; sprintf(logBuf, "启用学生:%s", id); writeLog("管理员", logBuf); pauseSystem(); }

// 搜索学生 void searchStu() { clearScreen(); char key[20]; cout << "输入学号/姓名关键词:"; cin >> key; bool flag = false; for (int i = 0; i < stuCount; i++) { if (strstr(stuList[i].stuId, key) != NULL || strstr(stuList[i].stuName, key) != NULL) { flag = true; cout << "学号:" << stuList[i].stuId << " 姓名:" << stuList[i].stuName << " 班级:" << stuList[i].className << " 状态:" << (stuList[i].status ? "正常" : "禁用") << endl; } } if (!flag) cout << "未找到学生!" << endl; pauseSystem(); }

// 发布公告 void publishNotice() { clearScreen(); Notice n; cout << "公告编号:"; cin >> n.noticeId; if (isNoticeExist(n.noticeId) != -1) { cout << "编号已存在!" << endl; pauseSystem(); return; } cout << "公告标题:"; cin >> n.title; cout << "公告内容:"; cin.ignore(); cin.getline(n.content, 200); strcpy(n.publishTime, getCurrentTime()); strcpy(n.publisher, "admin"); n.status = 1; noticeList[noticeCount++] = n; cout << "公告发布成功!" << endl; writeLog("管理员", "发布系统公告"); pauseSystem(); }

// 查看公告 void showAllNotice() { clearScreen(); cout << "===================================== 系统公告 " "=====================================" << endl; for (int i = 0; i < noticeCount; i++) { if (noticeList[i].status == 1) { cout << "【" << noticeList[i].noticeId << "】" << noticeList[i].title << endl; cout << "发布时间:" << noticeList[i].publishTime << "\n内容:" << noticeList[i].content << endl; cout << "----------------------------------------------------------------" "------------\n"; } } pauseSystem(); }

// 删除公告 void deleteNotice() { clearScreen(); showAllNotice(); char id[20]; cout << "输入要删除的公告编号:"; cin >> id; int idx = isNoticeExist(id); if (idx == -1) { cout << "公告不存在!" << endl; pauseSystem(); return; } noticeList[idx].status = 0; cout << "公告删除成功!" << endl; pauseSystem(); }

// 修改公告 void modifyNotice() { clearScreen(); showAllNotice(); char id[20]; cout << "输入公告编号:"; cin >> id; int idx = isNoticeExist(id); if (idx == -1) { cout << "公告不存在!" << endl; pauseSystem(); return; } cout << "新标题:"; cin >> noticeList[idx].title; cout << "新内容:"; cin.ignore(); cin.getline(noticeList[idx].content, 200); cout << "修改成功!" << endl; pauseSystem(); }

// 活动统计 void statisticsActivity() { clearScreen(); int total = 0, check = 0, pass = 0, fail = 0; for (int i = 0; i < actCount; i++) { total++; if (actList[i].status == 0) check++; else if (actList[i].status == 1) pass++; else fail++; }

cout << "========== 活动统计 ==========" << endl;
cout << "总活动数:" << total << endl;
cout << "待审核:" << check << endl;
cout << "已通过:" << pass << endl;
cout << "未通过:" << fail << endl;
pauseSystem();

}

// 社团统计 void statisticsClub() { clearScreen(); cout << "========== 社团统计 ==========" << endl; cout << "总社团数:" << clubCount << endl; int normal = 0, del = 0; for (int i = 0; i < clubCount; i++) { if (clubList[i].status == 1) normal++; else del++; } cout << "正常社团:" << normal << " 个\n注销社团:" << del << " 个\n"; pauseSystem(); }

// 导出报名数据 void exportApplyData() { clearScreen(); ofstream fout("apply_export.csv"); fout << "报名编号,活动编号,学号,姓名,报名时间,签到状态" << endl; for (int i = 0; i < applyCount; i++) { fout << applyList[i].applyId << "," << applyList[i].actId << "," << applyList[i].stuId << "," << applyList[i].stuName << "," << applyList[i].applyTime << "," << (applyList[i].isCheckIn ? "已签到" : "未签到") << endl; } fout.close(); cout << "报名数据已导出到 apply_export.csv 文件!" << endl; pauseSystem(); }

// 查看系统日志 void showSystemLog() { clearScreen(); cout << "============================================= 系统日志 " "=============================================" << endl; cout << left << setw(25) << "时间" << setw(10) << "类型" << setw(60) << "内容" << endl; for (int i = 0; i < logCount; i++) { cout << left << setw(25) << logList[i].time << setw(10) << logList[i].type << setw(60) << logList[i].content << endl; } pauseSystem(); }

// 清空日志 void clearSystemLog() { logCount = 0; cout << "系统日志已清空!" << endl; writeLog("系统", "管理员清空系统日志"); pauseSystem(); }

// 社团负责人菜单 void clubMenu() { int choice; while (true) { clearScreen(); cout << "=============================================" << endl; cout << " 社团负责人功能菜单 " << endl; cout << "=============================================" << endl; cout << " 1. 发布活动 2. 查看本社团活动 3. 修改活动 " << endl; cout << " 4. 删除活动 5. 查看报名人员 6. 活动签到 " << endl; cout << " 7. 社团详情 8. 查看社团成员 9. 添加成员 " << endl; cout << "10. 删除成员 11. 查看活动评论 0. 返回菜单 " << endl; cout << "=============================================" << endl; cout << "请输入选择:"; cin >> choice;

    switch (choice) {
    case 1:
        addActivity();
        break;
    case 2:
        showMyClubActivity();
        break;
    case 3:
        modifyActivity();
        break;
    case 4:
        deleteActivity();
        break;
    case 5:
        showApplyByAct();
        break;
    case 6:
        checkInApply();
        break;
    case 7:
        showClubDetail();
        break;
    case 8:
        showClubMember();
        break;
    case 9:
        addClubMember();
        break;
    case 10:
        deleteClubMember();
        break;
    case 11:
        showActivityComment();
        break;
    case 0:
        return;
    default:
        cout << "错误!" << endl;
        pauseSystem();
    }
}

}

// 发布活动 void addActivity() { clearScreen(); cout << "========== 发布活动 ==========" << endl; Activity a;

cout << "活动编号:";
cin >> a.actId;
if (isActExist(a.actId) != -1) {
    cout << "编号重复!" << endl;
    pauseSystem();
    return;
}

cin.ignore();
cout << "活动名称:";
cin.getline(a.actName, 50);
cout << "活动类型:";
cin.getline(a.actType, 30);
strcpy(a.clubId, currentClubId);

int cIdx = isClubExist(currentClubId);
strcpy(a.clubName, clubList[cIdx].clubName);

cout << "活动时间:";
cin.getline(a.actTime, 50);
cout << "活动地点:";
cin.getline(a.actPlace, 50);
cout << "最大人数:";
cin >> a.maxNum;
cin.ignore();

a.nowNum = 0;
a.status = 0;
a.score = 0;
a.commentCount = 0;
strcpy(a.publishTime, getCurrentTime());

cout << "活动简介:";
cin.getline(a.actIntro, 300);

actList[actCount++] = a;
cout << "发布成功,等待审核!" << endl;
char logBuf[200];
sprintf(logBuf, "发布活动:%s", a.actName);
writeLog("社团", logBuf);
pauseSystem();

}

// 查看本社团活动 void showMyClubActivity() { clearScreen(); cout << "============================================= 本社团活动 " "=============================================" << endl; cout << left << setw(15) << "编号" << setw(20) << "名称" << setw(15) << "时间" << setw(15) << "地点" << setw(10) << "最大" << setw(10) << "已报" << setw(10) << "状态" << endl;

for (int i = 0; i < actCount; i++) {
    if (strcmp(actList[i].clubId, currentClubId) == 0) {
        cout << left << setw(15) << actList[i].actId << setw(20)
             << actList[i].actName << setw(15) << actList[i].actTime << setw(15)
             << actList[i].actPlace << setw(10) << actList[i].maxNum << setw(10)
             << actList[i].nowNum;

        if (actList[i].status == 0)
            cout << setw(10) << "待审核";
        else if (actList[i].status == 1)
            cout << setw(10) << "已通过";
        else
            cout << setw(10) << "未通过";
        cout << endl;
    }
}
pauseSystem();

}

// 修改活动 void modifyActivity() { clearScreen(); showMyClubActivity(); char id[20]; cout << "输入活动编号:"; cin >> id;

int idx = -1;
for (int i = 0; i < actCount; i++) {
    if (strcmp(actList[i].actId, id) == 0 &&
        strcmp(actList[i].clubId, currentClubId) == 0) {
        idx = i;
        break;
    }
}

if (idx == -1) {
    cout << "无权限或不存在!" << endl;
    pauseSystem();
    return;
}
cin.ignore();
cout << "新名称:";
cin.getline(actList[idx].actName, 50);
cout << "新时间:";
cin.getline(actList[idx].actTime, 50);
cout << "新地点:";
cin.getline(actList[idx].actPlace, 50);
cout << "新人数:";
cin >> actList[idx].maxNum;
cin.ignore();
cout << "新类型:";
cin.getline(actList[idx].actType, 30);

cout << "新简介:";
cin.getline(actList[idx].actIntro, 300);

cout << "修改成功!" << endl;
pauseSystem();

}

// 活动签到 void checkInApply() { clearScreen(); char actId[20]; cout << "输入活动编号:"; cin >> actId; cout << "输入签到学生学号:"; char stuId[20]; cin >> stuId;

for (int i = 0; i < applyCount; i++) {
    if (strcmp(applyList[i].actId, actId) == 0 &&
        strcmp(applyList[i].stuId, stuId) == 0 && applyList[i].status == 1) {
        applyList[i].isCheckIn = 1;
        strcpy(applyList[i].checkInTime, getCurrentTime());
        cout << "签到成功!" << endl;
        pauseSystem();
        return;
    }
}
cout << "未找到该报名记录!" << endl;
pauseSystem();

}

// 社团详情 void showClubDetail() { clearScreen(); int idx = isClubExist(currentClubId); cout << "========== 社团详情 ==========" << endl; cout << "编号:" << clubList[idx].clubId << endl; cout << "名称:" << clubList[idx].clubName << endl; cout << "类型:" << clubList[idx].clubType << endl; cout << "负责人:" << clubList[idx].chargeName << endl; cout << "成员数量:" << clubList[idx].memberNum << endl; cout << "创建时间:" << clubList[idx].createTime << endl; cout << "简介:" << clubList[idx].clubIntro << endl; pauseSystem(); }

// 查看社团成员 void showClubMember() { clearScreen(); char filename[50]; sprintf(filename, "club_member_%s.txt", currentClubId); ifstream fin(filename); cout << "========== 社团成员 ==========\n"; char id[20]; while (fin >> id) { int idx = isStuExist(id); if (idx != -1) { cout << "学号:" << id << " 姓名:" << stuList[idx].stuName << " 班级:" << stuList[idx].className << endl; } } fin.close(); pauseSystem(); }

// 添加社团成员 void addClubMember() { clearScreen(); char stuId[20]; cout << "输入要添加的学生学号:"; cin >> stuId; if (isStuExist(stuId) == -1) { cout << "学生不存在!" << endl; pauseSystem(); return; } if (isClubMember(currentClubId, stuId)) { cout << "已是社团成员!" << endl; pauseSystem(); return; }

char filename[50];
sprintf(filename, "club_member_%s.txt", currentClubId);
ofstream fout(filename, ios::app);
fout << stuId << endl;
fout.close();

int idx = isClubExist(currentClubId);
clubList[idx].memberNum++;
cout << "添加成功!" << endl;
pauseSystem();

}

// 删除社团成员 void deleteClubMember() { clearScreen(); char stuId[20]; cout << "输入要删除的学生学号:"; cin >> stuId;

char filename[50];
sprintf(filename, "club_member_%s.txt", currentClubId);
ifstream fin(filename);
ofstream fout("temp.txt");
char id[20];
bool flag = false;
while (fin >> id) {
    if (strcmp(id, stuId) != 0) {
        fout << id << endl;
    } else {
        flag = true;
    }
}
fin.close();
fout.close();

remove(filename);
rename("temp.txt", filename);

if (flag) {
    int idx = isClubExist(currentClubId);
    clubList[idx].memberNum--;
    cout << "删除成功!" << endl;
} else {
    cout << "该学生不是社团成员!" << endl;
}
pauseSystem();

}

// 查看活动评论 void showActivityComment() { clearScreen(); char actId[20]; cout << "输入活动编号:"; cin >> actId; cout << "\n活动评论:\n"; bool flag = false; for (int i = 0; i < commentCount; i++) { if (strcmp(commentList[i].actId, actId) == 0 && commentList[i].status == 1) { flag = true; cout << commentList[i].stuName << ":" << commentList[i].content << " [" << commentList[i].comTime << "]" << endl; } } if (!flag) cout << "暂无评论!" << endl; pauseSystem(); }

// 学生菜单 void stuMenu() { int choice; while (true) { clearScreen(); cout << "=============================================" << endl; cout << " 学生功能菜单 " << endl; cout << "=============================================" << endl; cout << " 1. 查看所有活动 2. 报名活动 3. 取消报名 " << endl; cout << " 4. 我的报名记录 5. 搜索活动 6. 活动评分 " << endl; cout << " 7. 活动评论 8. 修改信息 9. 个人信息 " << endl; cout << "10. 查看公告 11. 报名状态 0. 返回菜单 " << endl; cout << "=============================================" << endl; cout << "请输入选择:"; cin >> choice;

    switch (choice) {
    case 1:
        showAllActivity();
        break;
    case 2:
        applyActivity();
        break;
    case 3:
        cancelApply();
        break;
    case 4:
        showMyApply();
        break;
    case 5:
        searchActivity();
        break;
    case 6:
        activityScore();
        break;
    case 7:
        activityComment();
        break;
    case 8:
        modifyStuInfo();
        break;
    case 9:
        showStuInfo();
        break;
    case 10:
        showAllNotice();
        break;
    case 11:
        checkApplyStatus();
        break;
    case 0:
        return;
    default:
        cout << "错误!" << endl;
        pauseSystem();
    }
}

}

// 查看所有活动 void showAllActivity() { clearScreen(); cout << "===================================================== 所有活动信息 " "=====================================================" << endl; cout << left << setw(15) << "编号" << setw(25) << "名称" << setw(15) << "类型" << setw(20) << "社团" << setw(15) << "时间" << setw(15) << "地点" << setw(10) << "最大" << setw(10) << "已报" << setw(10) << "状态" << endl;

for (int i = 0; i < actCount; i++) {
    cout << left << setw(15) << actList[i].actId << setw(25)
         << actList[i].actName << setw(15) << actList[i].actType << setw(20)
         << actList[i].clubName << setw(15) << actList[i].actTime << setw(15)
         << actList[i].actPlace << setw(10) << actList[i].maxNum << setw(10)
         << actList[i].nowNum;

    if (actList[i].status == 0)
        cout << setw(10) << "待审核";
    else if (actList[i].status == 1)
        cout << setw(10) << "可报名";
    else
        cout << setw(10) << "未通过";
    cout << "\n简介:" << actList[i].actIntro << endl;
    cout << "------------------------------------------------------------------"
            "-------------------------------------------------"
         << endl;
}
pauseSystem();

}

// 报名活动 void applyActivity() { clearScreen(); showAllActivity(); char id[20]; cout << "输入活动编号:"; cin >> id;

int idx = isActExist(id);
if (idx == -1 || actList[idx].status != 1) {
    cout << "无法报名!" << endl;
    pauseSystem();
    return;
}

if (actList[idx].nowNum >= actList[idx].maxNum) {
    cout << "已满员!" << endl;
    pauseSystem();
    return;
}

if (isApplied(currentStuId, id)) {
    cout << "已报名!" << endl;
    pauseSystem();
    return;
}

Apply a;
sprintf(a.applyId, "AP%03d", applyCount + 1);
strcpy(a.actId, id);
strcpy(a.stuId, currentStuId);

int sIdx = isStuExist(currentStuId);
strcpy(a.stuName, stuList[sIdx].stuName);
strcpy(a.applyTime, getCurrentTime());
a.status = 1;
a.isCheckIn = 0;
strcpy(a.checkInTime, "未签到");

applyList[applyCount++] = a;
actList[idx].nowNum++;

cout << "报名成功!" << endl;
char logBuf[200];
sprintf(logBuf, "%s 报名:%s", currentStuId, id);
writeLog("学生", logBuf);
pauseSystem();

}

// 取消报名 void cancelApply() { clearScreen(); showMyApply(); char id[20]; cout << "输入活动编号:"; cin >> id;

int idx = -1;
for (int i = 0; i < applyCount; i++) {
    if (strcmp(applyList[i].stuId, currentStuId) == 0 &&
        strcmp(applyList[i].actId, id) == 0 && applyList[i].status == 1) {
        idx = i;
        break;
    }
}

if (idx == -1) {
    cout << "未报名!" << endl;
    pauseSystem();
    return;
}

applyList[idx].status = 0;
for (int i = 0; i < actCount; i++) {
    if (strcmp(actList[i].actId, id) == 0) {
        actList[i].nowNum--;
        break;
    }
}

cout << "取消成功!" << endl;
pauseSystem();

}

// 我的报名 void showMyApply() { clearScreen(); cout << "============================================= 我的报名 " "=============================================" << endl; cout << left << setw(15) << "报名号" << setw(20) << "活动名" << setw(18) << "报名时间" << setw(10) << "状态" << setw(12) << "签到状态" << endl;

bool f = false;
for (int i = 0; i < applyCount; i++) {
    if (strcmp(applyList[i].stuId, currentStuId) == 0) {
        f = true;
        char an[50];
        for (int j = 0; j < actCount; j++) {
            if (strcmp(actList[j].actId, applyList[i].actId) == 0) {
                strcpy(an, actList[j].actName);
                break;
            }
        }
        cout << left << setw(15) << applyList[i].applyId << setw(20) << an
             << setw(18) << applyList[i].applyTime << setw(10)
             << (applyList[i].status == 1 ? "正常" : "已取消") << setw(12)
             << (applyList[i].isCheckIn ? "已签到" : "未签到") << endl;
    }
}

if (!f)
    cout << "暂无报名!" << endl;
pauseSystem();

}

// 搜索活动 void searchActivity() { clearScreen(); char key[50]; cout << "输入关键词:"; cin >> key;

bool f = false;
for (int i = 0; i < actCount; i++) {
    if (strstr(actList[i].actName, key) != NULL && actList[i].status == 1) {
        f = true;
        cout << "\n编号:" << actList[i].actId << "\n名称:" << actList[i].actName
             << "\n社团:" << actList[i].clubName << "\n时间:"
             << actList[i].actTime << "\n地点:" << actList[i].actPlace
             << "\n简介:" << actList[i].actIntro << endl;
    }
}

if (!f)
    cout << "无结果!" << endl;
pauseSystem();

}

// 活动评分 void activityScore() { clearScreen(); char actId[20]; cout << "输入要评分的活动编号:"; cin >> actId; if (!isApplied(currentStuId, actId)) { cout << "未参加该活动,无法评分!" << endl; pauseSystem(); return; } int idx = isActExist(actId); if (idx == -1) { cout << "活动不存在!" << endl; pauseSystem(); return; } int score; cout << "请输入评分(1-5分):"; cin >> score; if (score < 1 || score > 5) { cout << "评分无效!" << endl; pauseSystem(); return; } actList[idx].score += score; cout << "评分成功!感谢你的反馈!" << endl; pauseSystem(); }

// 活动评论 void activityComment() { clearScreen(); char actId[20]; cout << "输入活动编号:"; cin >> actId; if (!isApplied(currentStuId, actId)) { cout << "未参加该活动,无法评论!" << endl; pauseSystem(); return; } Comment c; sprintf(c.comId, "COM%03d", commentCount + 1); strcpy(c.actId, actId); strcpy(c.stuId, currentStuId); int sIdx = isStuExist(currentStuId); strcpy(c.stuName, stuList[sIdx].stuName); cout << "请输入评论内容:"; cin.ignore(); cin.getline(c.content, 150); strcpy(c.comTime, getCurrentTime()); c.status = 1; commentList[commentCount++] = c;

int aIdx = isActExist(actId);
actList[aIdx].commentCount++;
cout << "评论发布成功!" << endl;
pauseSystem();

}

// 修改信息 void modifyStuInfo() { clearScreen(); int idx = isStuExist(currentStuId); cout << "========== 修改信息 ==========" << endl; cout << "新密码:"; cin >> stuList[idx].stuPwd; cout << "新班级:"; cin >> stuList[idx].className; cout << "新手机:"; cin >> stuList[idx].phone; cout << "新邮箱:"; cin >> stuList[idx].email; cout << "新专业:"; cin >> stuList[idx].major; cout << "修改成功!" << endl; pauseSystem(); }

// 报名状态 void checkApplyStatus() { clearScreen(); char id[20]; cout << "输入活动编号:"; cin >> id;

if (isApplied(currentStuId, id))
    cout << "已报名!" << endl;
else
    cout << "未报名!" << endl;
pauseSystem();

}

// 查看报名人员 void showApplyByAct() { clearScreen(); char id[20]; cout << "输入活动编号:"; cin >> id;

cout << "============================================= 报名人员 "
        "============================================="
     << endl;
cout << left << setw(15) << "报名号" << setw(15) << "学号" << setw(15)
     << "姓名" << setw(20) << "报名时间" << setw(12) << "签到状态" << endl;

bool f = false;
for (int i = 0; i < applyCount; i++) {
    if (strcmp(applyList[i].actId, id) == 0 && applyList[i].status == 1) {
        f = true;
        cout << left << setw(15) << applyList[i].applyId << setw(15)
             << applyList[i].stuId << setw(15) << applyList[i].stuName << setw(20)
             << applyList[i].applyTime << setw(12)
             << (applyList[i].isCheckIn ? "已签到" : "未签到") << endl;
    }
}

if (!f)
    cout << "暂无报名!" << endl;
pauseSystem();

}

Introduction

可用于校园内社团活动的发布、报名及管理,支持管理员、社团负责人和学生三种角色,具备活动发布、报名审核、评论互动、数据统计等核心功能。【此简介由AI生成】

Customize your domain