| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2514 人关注过本帖, 1 人收藏
标题:我在中秋节刚刚完成的c语言课程设计(成绩管理系统)源程序,免费发布出来(最新 ...
只看楼主 加入收藏
wangjianlin2008
Rank: 1
来 自:四川
等 级:新手上路
帖 子:207
专家分:0
注 册:2008-6-22
结帖率:40%
收藏(1)
 问题点数:0 回复次数:8 
我在中秋节刚刚完成的c语言课程设计(成绩管理系统)源程序,免费发布出来(最新哦!)
/**
  C语言课程设计题目源程序: 成绩管理系统

  系统要求: 包含三类用户,管理员,教师,学生
        管理员功能:            
                (1)自身密码修改
                (2)教师信息管理:添加,修改,查询,删除
                (3)学生信息管理:添加,修改,查询,删除
                (4)成绩信息管理:添加,修改,查询,删除
                (5)课程信息管理:添加,修改,查询,删除
                (6)授课信息管理:添加,修改,查询,删除
                (7)退出登陆系统
        教师功能:
                (1)个人信息修改
                (2)学生信息管理: 只能查看学生的信息
                (3)成绩信息管理: 添加,修改,删除(只限该老师所授课程),查询(所有学生成绩)
                (4)退出登陆系统
        学生功能:
                (1)个人信息修改
                (2)成绩信息管理: 只能查询自己的成绩
                (3)退出登陆系统
**************************************************
    程序作者: 双鱼林  作者真实姓名:  汪建林
    生日: 1985年2月26日 星座: 双鱼座
    血型: 0  家乡: 四川达州
    QQ: 287307421 手机:13558690869
    淘宝店: http://shop34864101.
    程序制作时间: 2008年中秋佳节 请朋友们随便传播,但不要把作者信息删除
***************************************************
**/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define ADMIN_USER_TYPE 1
#define TEACHER_USER_TYPE 2
#define STUDENT_USER_TYPE 3


#define FUNCTION_FAILED -1
#define FUNCTION_SUCCESS 0

/** 管理员身份信息表 **/
typedef struct AdminInfo {
    char adminName[20];                    //管理员帐号,主键
    char password[20];                    //管理员密码
    struct AdminInfo *next;                //指向下一个管理员信息
} AdminInfo;


/** 教师信息表  **/
typedef struct TeacherInfo {
    char teacherId[20];                    //教工号,主键
    char teacherPassword[20];            //教师登陆密码
    char teacherName[20];                //教师姓名
    char teacherSex[4];                    //教师性别
    char teacherBirthTime[15];            //教师生日
    char teacherAddress[50];            //教师居住地址
    struct TeacherInfo *next;            //指向下一个教师的信息
} TeacherInfo;


/** 学生信息 **/
typedef struct StudentInfo {
    char studentNumber[20];                //学号,主键
    char studentName[10];                //姓名
    char studentPassword[20];            //学生登陆密码
    char studentSex[4];                    //学生性别
    char studentBirthTime[15];            //学生生日
    char studentAddress[50];            //学生居住地址
    struct StudentInfo *next;            //指向下一个学生的信息
} StudentInfo;


/** 课程信息 **/
typedef struct CourseInfo {
    int    courseId;                        //课程编号,主键
    char courseName[20];                //课程名称
    char courseClassroom[20];            //上课所在教室
    char courseTime[20];                //上课时间
    struct CourseInfo *next;            //指向下一门课程的信息
} CourseInfo;

/** 授课信息 **/
typedef struct CourseTeachInfo {
    int     courseId;                        //课程编号
    char teacherId[20];                    //教师编号
    struct CourseTeachInfo *next;        //指向下一条教师授课信息
} CourseTeachInfo;


/** 学生成绩信息 **/
typedef struct ScoreInfo {
    char studentNumber[20];                //学生学号
    int courseId;                        //课程编号
    float score;                        //课程成绩
    struct ScoreInfo *next;                //指向下一条成绩信息
} ScoreInfo;


static AdminInfo *pAdminInfoHead = NULL;                //指向系统管理员信息记录的头指针
static CourseInfo *pCourseInfoHead = NULL;                //指向课程信息记录的头指针
static CourseTeachInfo *pCourseTeachInfoHead = NULL;    //指向教师授课信息记录的头指针
static ScoreInfo *pScoreInfoHead = NULL;                //指向成绩记录信息的头指针
static StudentInfo *pStudentInfoHead = NULL;            //指向学生信息记录的头指针
static TeacherInfo *pTeacherInfoHead = NULL;            //指向教师信息记录的头指针

static char currentUserName[20];                    /*保存登陆系统的当前帐号*/
static char currentUserType[20];                    /*保存登陆系统的身份*/

void InitSystem();                            /*初始化系统函数,向各种信息链表中加入测试数据*/
int AddAdminInfo(AdminInfo *);                /*向管理员信息链表中加入一条管理员信息*/
int AddOneCourseInfo(CourseInfo *);            /*向课程信息链表中加入一条课程信息*/
int AddOneTeacherInfo(TeacherInfo *);        /*向教师信息链表中加入一条教师信息*/
int AddOneStudentInfo(StudentInfo *);        /*向学生信息链表中加入一条学生信息*/
int AddOneCourseTeachInfo(CourseTeachInfo *);/*向授课信息链表中加入一条授课信息*/
int AddOneScoreInfo(ScoreInfo *);            /*向成绩链表中加入一条成绩信息*/
void GetStudentName(char *,char *);            /*得到某个学号的学生姓名*/
void GetCourseName(int,char *);                /*得到某门课程编号的名称*/
void GetTeacherName(char *,char *);            /*根据教师编号得到教师姓名*/
bool IsHavingStudentNumber(char *);            /*判断是否存在某个学号的学生信息*/
bool IsHavingCourseId(int );                /*判断是否存在某门课程的信息*/
bool IsHavingTeacherId(char *);                /*判断是否存在某个教师信息*/
bool CanTeacherOpeScore(int ,char *);        /*判断某个老师是否有添加某门课程成绩的权限*/
bool IsCourseInTeachInfo(int );                /*判断某门课程是否在授课信息中存在*/
bool IsCourseInScoreInfo(int );                /*判断某门课程是否在成绩信息中存在*/
void ShowWelcomeMenu();                        /*显示系统欢迎菜单*/
int AdminLogin();                            /*管理员身份登陆系统*/
int TeacherLogin();                            /*教师身份登陆系统*/
int StudentLogin();                            /*学生身份登陆系统*/
void SelectLoginType();                        /*选择登陆系统的身份*/
void ShowAdminMenu();                        /*显示管理员操作菜单*/
  void AdminPasswordModify();                /*管理员修改自己的密码*/
  void TeacherInfoManage();                    /*教师信息管理*/
    void TeacherInfoView();                    /*教师信息查看*/
    void TeacherInfoAdd();                    /*教师信息添加*/
    void TeacherInfoModify();                /*教师信息修改*/
    void TeacherInfoDelete();                /*教师信息删除*/
  void StudentInfoManage();                    /*学生信息管理*/
    /*学生信息查看功能同教师身份登陆时的学生信息查看一样*/
    void StudentInfoAdd();                    /*学生信息添加*/
    void StudentInfoModify();                /*学生信息修改*/
    void StudentInfoDelete();                /*学生信息删除*/
  void Admin_ScoreInfoManage();                /*管理员对成绩信息管理*/
      void ScoreInfoView();                    /*成绩信息查看*/
    void ScoreInfoAdd();                    /*成绩信息添加*/
    void ScoreInfoModify();                    /*成绩信息修改*/
    void ScoreInfoDelete();                    /*成绩信息删除*/
  void CourseInfoManage();                    /*课程信息管理*/
      void CourseInfoView();                    /*课程信息查看*/
    void CourseInfoAdd();                    /*课程信息添加*/
    void CourseInfoModify();                /*课程信息修改*/
    void CourseInfoDelete();                /*课程信息删除*/
  void CourseTeachInfoManage();                /*授课信息管理*/
    void CourseTeachInfoView();                /*授课信息查看*/
    void CourseTeachInfoAdd();                /*授课信息添加*/
    void CourseTeachInfoModify();            /*授课信息修改*/
    void CourseTeachInfoDelete();            /*授课信息删除*/
void ShowTeacherMenu();                        /*显示教师身份操作菜单*/
  void TeacherSelfInfoModify();                /*教师信息修改*/
  void StudentInfoView();                    /*学生信息查看*/
  void Teacher_ScoreInfoManage();            /*教师对成绩信息管理*/
    void ScoreInfoView();                    /*成绩信息查看*/
    void ScoreInfoAdd();                    /*成绩信息添加*/
    void ScoreInfoModify();                    /*成绩信息修改*/
    void ScoreInfoDelete();                    /*成绩信息删除*/
void ShowStudentMenu();                        /*显示学生身份操作菜单*/
    void StudentSelfInfoModify();            /*学生个人信息修改*/
    void Student_ScoreInfoView();            /*学生本人成绩查询*/
void InitSystem() {                /*初始化系统函数,向各种信息链表中加入测试数据*/
    AdminInfo adminInfo;        /*初始化一个管理员信息*/
    strcpy(adminInfo.adminName,"admin");
    strcpy(adminInfo.password,"admin");
    adminInfo.next = NULL;
    AddAdminInfo(&adminInfo);    /*将这个管理员信息加入到管理员信息链表中*/

    CourseInfo courseInfo[3];    /*初始化三门课程信息*/
    strcpy(courseInfo[0].courseClassroom,"6A-101");
    strcpy(courseInfo[1].courseClassroom,"6A-102");
    strcpy(courseInfo[2].courseClassroom,"6A-103");
    strcpy(courseInfo[0].courseName,"计算机网络");
    strcpy(courseInfo[1].courseName,"毛泽东思想");
    strcpy(courseInfo[2].courseName,"C语言程序设计");
    strcpy(courseInfo[0].courseTime,"星期一上午一二节课");
    strcpy(courseInfo[1].courseTime,"星期五下午三四节课");
    strcpy(courseInfo[2].courseTime,"星期三晚上三节课");
    courseInfo[0].next = courseInfo[1].next = courseInfo[2].next = NULL;
    for(int i=0;i<3;i++) AddOneCourseInfo(&courseInfo[i]);

    TeacherInfo teacherInfo[3]; /*初始化三个教师信息*/
    strcpy(teacherInfo[0].teacherId,"TH001");
    strcpy(teacherInfo[1].teacherId,"TH002");
    strcpy(teacherInfo[2].teacherId,"TH003");
    strcpy(teacherInfo[0].teacherName,"汪老师");
    strcpy(teacherInfo[1].teacherName,"梁老师");
    strcpy(teacherInfo[2].teacherName,"李老师");
    strcpy(teacherInfo[0].teacherPassword,"TH001");
    strcpy(teacherInfo[1].teacherPassword,"TH002");
    strcpy(teacherInfo[2].teacherPassword,"TH003");
    strcpy(teacherInfo[0].teacherSex,"男");
    strcpy(teacherInfo[1].teacherSex,"女");
    strcpy(teacherInfo[2].teacherSex,"男");
    strcpy(teacherInfo[0].teacherBirthTime,"1975年3月12日");
    strcpy(teacherInfo[1].teacherBirthTime,"1980年7月5日");
    strcpy(teacherInfo[2].teacherBirthTime,"1978年1月17日");
    strcpy(teacherInfo[0].teacherAddress,"四川成都");
    strcpy(teacherInfo[1].teacherAddress,"湖南长沙");
    strcpy(teacherInfo[2].teacherAddress,"云南昆明");
    teacherInfo[0].next = teacherInfo[1].next = teacherInfo[2].next = NULL;
    for(i=0;i<3;i++) AddOneTeacherInfo(&teacherInfo[i]);

    StudentInfo studentInfo[3];    /*初始化三个学生信息*/
    strcpy(studentInfo[0].studentAddress,"湖北武汉");
    strcpy(studentInfo[1].studentAddress,"上海");
    strcpy(studentInfo[2].studentAddress,"四川达州");
    strcpy(studentInfo[0].studentBirthTime,"1987年3月18日");
    strcpy(studentInfo[1].studentBirthTime,"1989年9月19日");
    strcpy(studentInfo[2].studentBirthTime,"1988年6月15日");
    strcpy(studentInfo[0].studentName,"汪建林");
    strcpy(studentInfo[1].studentName,"张高铅");
    strcpy(studentInfo[2].studentName,"蒋介石");
    strcpy(studentInfo[0].studentNumber,"200305030317");
    strcpy(studentInfo[1].studentNumber,"200305030318");
    strcpy(studentInfo[2].studentNumber,"200305030320");
    strcpy(studentInfo[0].studentPassword,"1234");
    strcpy(studentInfo[1].studentPassword,"1234");
    strcpy(studentInfo[2].studentPassword,"1234");
    strcpy(studentInfo[0].studentSex,"男");
    strcpy(studentInfo[1].studentSex,"女");
    strcpy(studentInfo[2].studentSex,"男");
    studentInfo[0].next = studentInfo[1].next = studentInfo[2].next = NULL;
    for(i=0;i<3;i++) AddOneStudentInfo(&studentInfo[i]);

    CourseTeachInfo courseTeachInfo[3]; /*初始化三个教师授课信息*/
    courseTeachInfo[0].courseId = 1;
    courseTeachInfo[1].courseId = 2;
    courseTeachInfo[2].courseId = 3;
    strcpy(courseTeachInfo[0].teacherId,"TH001");
    strcpy(courseTeachInfo[1].teacherId,"TH002");
    strcpy(courseTeachInfo[2].teacherId,"TH003");
    courseTeachInfo[0].next = NULL;
    courseTeachInfo[1].next = NULL;
    courseTeachInfo[2].next = NULL;
    for(i=0;i<3;i++) AddOneCourseTeachInfo(&courseTeachInfo[i]);
}

int AddAdminInfo(AdminInfo *pAdminInfo) {
    /* 分配堆空间内存 */
    AdminInfo *pAdminInfoTmp = (AdminInfo *)malloc(sizeof(AdminInfo));
    if(NULL == pAdminInfoTmp) {
        printf("对不起,添加管理员信息时,堆内存分配失败!");
        return FUNCTION_FAILED;
    }
    /* 复制管理员信息 */
    strcpy(pAdminInfoTmp->adminName,pAdminInfo->adminName);
    strcpy(pAdminInfoTmp->password,pAdminInfo->password);
    /* 直接将堆空间的该记录的下一条记录指针指向头指针 */
    pAdminInfoTmp->next = pAdminInfoHead;
    /* 再将头指针重新指向该条记录 */
    pAdminInfoHead = pAdminInfoTmp;
    return FUNCTION_SUCCESS;
}

int AddOneCourseInfo(CourseInfo *pCourseInfo) {
    int courseId;            //程序自动生成课程编号
    CourseInfo *tmpCourseInfo = pCourseInfoHead;
    if(NULL == pCourseInfoHead)
        courseId = 1;
    else {
        while(NULL != tmpCourseInfo->next)
            tmpCourseInfo = tmpCourseInfo->next;
        courseId = tmpCourseInfo->courseId + 1;
    }

    CourseInfo *pCourseInfoTmp = (CourseInfo *)malloc(sizeof(CourseInfo));
    if(NULL == pCourseInfoTmp) {
        printf("对不起,添加课程信息时,堆内存分配失败!");
        return FUNCTION_FAILED;
    }
    strcpy(pCourseInfoTmp->courseClassroom,pCourseInfo->courseClassroom);
    pCourseInfoTmp->courseId = courseId;
    strcpy(pCourseInfoTmp->courseName,pCourseInfo->courseName);
    strcpy(pCourseInfoTmp->courseTime,pCourseInfo->courseTime);
    pCourseInfoTmp->next = pCourseInfo->next;

    if(NULL == pCourseInfoHead)
        pCourseInfoHead = pCourseInfoTmp;
    else
        tmpCourseInfo->next = pCourseInfoTmp;
    return FUNCTION_SUCCESS;
}

int AddOneTeacherInfo(TeacherInfo *pTeacherInfo) {
    /* 分配堆空间内存 */
    TeacherInfo *pTeacherInfoTmp = (TeacherInfo *)malloc(sizeof(TeacherInfo));
    if(NULL == pTeacherInfoTmp) {
        printf("对不起,添加教师信息时,堆内存分配失败!");
        return FUNCTION_FAILED;
    }
    /* 复制教师信息 */
    strcpy(pTeacherInfoTmp->teacherAddress,pTeacherInfo->teacherAddress);
    strcpy(pTeacherInfoTmp->teacherBirthTime,pTeacherInfo->teacherBirthTime);
    strcpy(pTeacherInfoTmp->teacherId,pTeacherInfo->teacherId);
    strcpy(pTeacherInfoTmp->teacherName,pTeacherInfo->teacherName);
    strcpy(pTeacherInfoTmp->teacherPassword,pTeacherInfo->teacherPassword);
    strcpy(pTeacherInfoTmp->teacherSex,pTeacherInfo->teacherSex);
    /* 直接将堆空间的该记录的下一条记录指针指向头指针 */
    pTeacherInfoTmp->next = pTeacherInfoHead;
    /* 再将头指针重新指向该条记录 */
    pTeacherInfoHead = pTeacherInfoTmp;
    return FUNCTION_SUCCESS;
}

int AddOneStudentInfo(StudentInfo *pStudentInfo) {
    /* 分配堆空间内存 */
    StudentInfo *pStudentInfoTmp = (StudentInfo *)malloc(sizeof(StudentInfo));
    if(NULL == pStudentInfoTmp) {
        printf("对不起,添加学生信息时,堆内存分配失败!");
        return FUNCTION_FAILED;
    }
    /* 复制学生信息 */
    strcpy(pStudentInfoTmp->studentAddress,pStudentInfo->studentAddress);
    strcpy(pStudentInfoTmp->studentBirthTime,pStudentInfo->studentBirthTime);
    strcpy(pStudentInfoTmp->studentName,pStudentInfo->studentName);
    strcpy(pStudentInfoTmp->studentNumber,pStudentInfo->studentNumber);
    strcpy(pStudentInfoTmp->studentPassword,pStudentInfo->studentPassword);
    strcpy(pStudentInfoTmp->studentSex,pStudentInfo->studentSex);

    /* 直接将堆空间的该记录的下一条记录指针指向头指针 */
    pStudentInfoTmp->next = pStudentInfoHead;
    /* 再将头指针重新指向该条记录 */
    pStudentInfoHead = pStudentInfoTmp;
    return FUNCTION_SUCCESS;
}

int AddOneCourseTeachInfo(CourseTeachInfo *pCourseTeachInfo) {
    /* 分配堆空间 */
    CourseTeachInfo *pCourseTeachInfoTmp = (CourseTeachInfo *)malloc(sizeof(CourseTeachInfo));
    if(NULL == pCourseTeachInfoTmp) {
        printf("对不起,添加授课信息时堆内存分配失败!");
        return FUNCTION_FAILED;
    }
    /* 复制授课信息 */
    strcpy(pCourseTeachInfoTmp->teacherId,pCourseTeachInfo->teacherId);
    pCourseTeachInfoTmp->courseId = pCourseTeachInfo->courseId;
    /* 直接将堆空间的该记录的下一条记录指针指向头指针 */
    pCourseTeachInfoTmp->next = pCourseTeachInfoHead;
    /* 再将头指针重新指向该条记录 */
    pCourseTeachInfoHead = pCourseTeachInfoTmp;
    return FUNCTION_SUCCESS;
}

int AddOneScoreInfo(ScoreInfo *pScoreInfo) {            /*向成绩链表中加入一条成绩信息*/
    /* 分配堆内存空间 */
    ScoreInfo *pScoreInfoTmp = (ScoreInfo *)malloc(sizeof(ScoreInfo));
    if(NULL == pScoreInfoTmp) {
        printf("对不起,添加成绩信息时堆内存空间分配失败!");
        return FUNCTION_FAILED;
    }
    /* 复制成绩信息 */
    pScoreInfoTmp->courseId = pScoreInfo->courseId;
    strcpy(pScoreInfoTmp->studentNumber,pScoreInfo->studentNumber);
    pScoreInfoTmp->score = pScoreInfo->score;
    /* 直接将堆空间的该记录的下一条记录指针指向头指针 */
    pScoreInfoTmp->next = pScoreInfoHead;
    /* 再将头指针重新指向该条记录 */
    pScoreInfoHead = pScoreInfoTmp;
    return FUNCTION_SUCCESS;
}

void ShowWelcomeMenu() {
    printf("********************************************************************************");
    printf("                 C语言课程设计题目: 成绩管理系统                 \n");
    printf("                                          程序设计by:双鱼林  QQ:287307421\n");
    printf("管理员功能:\n");
    printf("  (1)自身密码修改\n");
    printf("  (2)教师信息管理:添加,修改,查询,删除\n");
    printf("  (3)学生信息管理:添加,修改,查询,删除\n");
    printf("  (4)成绩信息管理:添加,修改,查询,删除\n");
    printf("  (5)课程信息管理:添加,修改,查询,删除\n");
    printf("  (6)授课信息管理:添加,修改,查询,删除\n");
    printf("  (7)退出登陆系统\n");
    printf("教师功能:\n");
    printf("  (1)个人信息修改\n");
    printf("  (2)学生信息管理: 只能查看学生的信息\n");
    printf("  (3)成绩信息管理: 添加,修改,删除(只限该老师所授课程),查询(所有学生成绩)\n");
    printf("  (4)退出登陆系统\n");
    printf("学生功能:\n");
    printf("  (1)个人信息修改\n");
    printf("  (2)成绩信息管理:只能查看自己的成绩\n");
    printf("  (3)退出登陆系统\n");
    printf("********************************************************************************");
}

int AdminLogin() {
    char adminName[20],password[20];
    bool haveAdminUser = false;        /*系统是否存在该帐号标志*/
    AdminInfo *tmpAdminInfo;
    printf("你好,你现在选择的是管理员身份登陆系统,请输入你的登陆帐号和密码\n");
    printf("登陆帐号:");
    scanf("%s",adminName);
    printf("密码:");
    scanf("%s",password);
    tmpAdminInfo = pAdminInfoHead;
    if(NULL == tmpAdminInfo) return FUNCTION_FAILED;
    while(NULL != tmpAdminInfo) {
        if(0 == strcmp(adminName,tmpAdminInfo->adminName)) {    /*找到该帐号信息*/
            haveAdminUser = true;                                /*设置存在标志*/
            if(0 == strcmp(password,tmpAdminInfo->password)) {    /*密码输入也正确*/
                strcpy(currentUserName,adminName);                /*保存当前帐号*/
                strcpy(currentUserType,"admin");                /*设置当前身份为管理员*/
                ShowAdminMenu();                                /*显示管理员操作菜单*/
                return FUNCTION_SUCCESS;
            } else {
                printf("对不起,你输入的密码错误!");
                return FUNCTION_FAILED;
            }
        } else {
            tmpAdminInfo = tmpAdminInfo->next;
        }
    }
    if(false == haveAdminUser) {
        printf("对不起,你输入的管理员帐号不存在!");
        return FUNCTION_FAILED;
    }
    return FUNCTION_SUCCESS;

}

int TeacherLogin() {
    char teacherId[20],teacherPassword[20];
    bool haveTeacherInfo = false;        /*系统是否存在该帐号标志*/
    TeacherInfo *tmpTeacherInfo;
    printf("你好,你现在选择的是教师身份登陆系统,请输入你的登陆帐号和密码\n");
    printf("登陆帐号(教师编号):");
    scanf("%s",teacherId);
    printf("密码:");
    scanf("%s",teacherPassword);
    tmpTeacherInfo = pTeacherInfoHead;
    if(NULL == tmpTeacherInfo) return FUNCTION_FAILED;
    while(NULL != tmpTeacherInfo) {
        if(0 == strcmp(teacherId,tmpTeacherInfo->teacherId)) {                    /*找到该帐号信息*/
            haveTeacherInfo = true;                                                /*设置存在标志*/
            if(0 == strcmp(teacherPassword,tmpTeacherInfo->teacherPassword)) {    /*密码输入也正确*/
                strcpy(currentUserName,teacherId);                                /*保存当前帐号*/
                strcpy(currentUserType,"teacher");                                /*设置当前身份为管理员*/
                ShowTeacherMenu();                                                /*显示教师操作操作菜单*/
                return FUNCTION_SUCCESS;
            } else {
                printf("对不起,你输入的密码错误!");
                return FUNCTION_FAILED;
            }
        } else {
            tmpTeacherInfo = tmpTeacherInfo->next;
        }
    }
    if(false == haveTeacherInfo) {
        printf("对不起,你输入的教师编号不存在!");
        return FUNCTION_FAILED;
    }
    return FUNCTION_SUCCESS;
}

int StudentLogin() {
    char studentNumber[20],studentPassword[20];
    bool haveStudentInfo = false;        /*系统是否存在该帐号标志*/
    StudentInfo *tmpStudentInfo;
    printf("你好,你现在选择的是学生身份登陆系统,请输入你的登陆帐号和密码\n");
    printf("登陆帐号(学号):");
    scanf("%s",studentNumber);
    printf("密码:");
    scanf("%s",studentPassword);
    tmpStudentInfo = pStudentInfoHead;
    if(NULL == tmpStudentInfo) return FUNCTION_FAILED;
    while(NULL != tmpStudentInfo) {
        if(0 == strcmp(studentNumber,tmpStudentInfo->studentNumber)) {            /*找到该帐号信息*/
            haveStudentInfo = true;                                                /*设置存在标志*/
            if(0 == strcmp(studentPassword,tmpStudentInfo->studentPassword)) {    /*密码输入也正确*/
                strcpy(currentUserName,studentNumber);                            /*保存当前帐号*/
                strcpy(currentUserType,"student");                                /*设置当前身份为管理员*/
                ShowStudentMenu();                                                /*显示教师操作操作菜单*/
                return FUNCTION_SUCCESS;
            } else {
                printf("对不起,你输入的密码错误!");
                return FUNCTION_FAILED;
            }
        } else {
            tmpStudentInfo = tmpStudentInfo->next;
        }
    }
    if(false == haveStudentInfo) {
        printf("对不起,你输入的学号不存在!");
        return FUNCTION_FAILED;
    }
    return FUNCTION_SUCCESS;
}

void ShowAdminMenu() {
    int select = 0;
    while(7!= select) {
        printf("你好,管理员,你拥有下面的这些功能,请通过选择相应的序号进入\n");
        printf("1--自身密码修改\n");
        printf("2--教师信息管理\n");
        printf("3--学生信息管理\n");
        printf("4--成绩信息管理\n");
        printf("5--课程信息管理\n");
        printf("6--授课信息管理\n");
        printf("7--退出登陆系统\n");
        scanf("%d",&select);
        switch(select) {
            case 1:
                AdminPasswordModify();
                continue;
            case 2:
                TeacherInfoManage();
                continue;
            case 3:
                StudentInfoManage();
                continue;
            case 4:
                Admin_ScoreInfoManage();
                continue;
            case 5:
                CourseInfoManage();
                continue;
            case 6:
                CourseTeachInfoManage();
                continue;
            default:
                continue;
        }
    }
    SelectLoginType();
}
void AdminPasswordModify() {            /*管理员修改自己的密码*/
    char oldPassword[20],newPassword[20],newPassword2[20];
    printf("请输入当前的密码:\n");
    scanf("%s",oldPassword);
    AdminInfo *tmpAdminInfo = pAdminInfoHead;
    while(NULL != tmpAdminInfo) {
        if(0 == strcmp(currentUserName,tmpAdminInfo->adminName)) {    /*首先找到要修改的记录*/
            if(0 == strcmp(oldPassword,tmpAdminInfo->password)) {    /*如果密码输入正确*/
                printf("请输入新的密码:\n");
                scanf("%s",newPassword);
                printf("请再次确认新密码:\n");
                scanf("%s",newPassword2);
                if(0 == strcmp(newPassword,newPassword2)) {            /*如果两次新的密码一致*/
                    strcpy(tmpAdminInfo->password,newPassword);
                    printf("密码修改成功!\n");
                }
                else
                    printf("对不起,你两次输入的新密码不一致!\n");
            } else {
                printf("对不起,你的旧密码输入不正确!\n");
            }
            break;
        } else {
            tmpAdminInfo = tmpAdminInfo->next;
        }
    }

}
void TeacherInfoManage() {                /*教师信息管理*/
    int select = 0;
    while(5 != select) {
        printf("你好,管理员,你现在进入的是教师信息管理功能模块,拥有下面的功能\n");
        printf("1--教师信息查看  2--教师信息添加  3--教师信息修改  4--教师信息删除  5--返回上级菜单\n");
        printf("请输入对应的功能号:");
        scanf("%d",&select);
        switch(select) {
            case 1:
                TeacherInfoView();
                continue;
            case 2:
                TeacherInfoAdd();
                continue;
            case 3:
                TeacherInfoModify();
                continue;
            case 4:
                TeacherInfoDelete();
                continue;
            default:
                continue;
        }
    }
    ShowAdminMenu();    /*返回上级菜单*/
}

/*由于程序过长,不能直接展示出来,请朋友下载附件*/

scoreManage.rar (242.66 KB)
搜索更多相关主题的帖子: c语言 课程设计 成绩管理 
2008-09-15 10:56
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 
strcpy(teacherInfo[0].teacherId,"TH001");
    strcpy(teacherInfo[1].teacherId,"TH002");
    strcpy(teacherInfo[2].teacherId,"TH003");
    strcpy(teacherInfo[0].teacherName,"汪老师");
    strcpy(teacherInfo[1].teacherName,"梁老师");
    strcpy(teacherInfo[2].teacherName,"李老师");
    strcpy(teacherInfo[0].teacherPassword,"TH001");
    strcpy(teacherInfo[1].teacherPassword,"TH002");
    strcpy(teacherInfo[2].teacherPassword,"TH003");
    strcpy(teacherInfo[0].teacherSex,"男");
    strcpy(teacherInfo[1].teacherSex,"女");
    strcpy(teacherInfo[2].teacherSex,"男");
    strcpy(teacherInfo[0].teacherBirthTime,"1975年3月12日");
    strcpy(teacherInfo[1].teacherBirthTime,"1980年7月5日");
    strcpy(teacherInfo[2].teacherBirthTime,"1978年1月17日");
    strcpy(teacherInfo[0].teacherAddress,"四川成都");
    strcpy(teacherInfo[1].teacherAddress,"湖南长沙");
    strcpy(teacherInfo[2].teacherAddress,"云南昆明");
    teacherInfo[0].next = teacherInfo[1].next = teacherInfo[2].next = NULL;
    for(i=0;i<3;i++) AddOneTeacherInfo(&teacherInfo[i]);

    StudentInfo studentInfo[3];    /*初始化三个学生信息*/





类似这种的有规律的,用个for把他处理掉

九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2008-09-15 11:17
wangjianlin2008
Rank: 1
来 自:四川
等 级:新手上路
帖 子:207
专家分:0
注 册:2008-6-22
收藏
得分:0 
回复 2# Knocker 的帖子
关键是各个字段的内容是没有规律的,是随机的啊!

专注于计算机毕业课程设计源码
QQ:254540457
2008-09-15 11:31
StarWing83
Rank: 8Rank: 8
来 自:仙女座大星云
等 级:贵宾
威 望:19
帖 子:3951
专家分:748
注 册:2007-11-16
收藏
得分:0 
你不知道从文件读取么?

放心,过个一年半年来看你这个程序,会发现有很多地方是可以改进的……

专心编程………
飞燕算法初级群:3996098
我的Blog
2008-09-15 13:42
wangjianlin2008
Rank: 1
来 自:四川
等 级:新手上路
帖 子:207
专家分:0
注 册:2008-6-22
收藏
得分:0 
回复 4# StarWing83 的帖子
肯定可以从文件读取吧,还会从各种数据库读取呢,只是没有那样做而已啊!其实关键是设计那些数据结构,就相当于数据库设计中的表设计哦,其他的程序都是次要的,数据结构才是最重要的!

[[it] 本帖最后由 wangjianlin2008 于 2008-9-15 17:53 编辑 [/it]]

专注于计算机毕业课程设计源码
QQ:254540457
2008-09-15 17:51
StarWing83
Rank: 8Rank: 8
来 自:仙女座大星云
等 级:贵宾
威 望:19
帖 子:3951
专家分:748
注 册:2007-11-16
收藏
得分:0 
话说,数据结构其实也比较糟糕,你难道不知道设计一个单独的链表结构,然后顺次包括这所有的结构么?

struct LinkNode
{
    struct LinkNode* next;
};

然后定义在LinkNode上的操作。
比如:
int insert_link(struct LinkNode** ln, struct LinkNode* node);

在使用的时候,可以:
struct Student
{
    struct LinkNode link;
    //....
};

struct Teacher
{
    struct LinkNode link;
    //....
};

然后在使用Link的操作的时候:
insert_link(&head,(struct LinkNode*)pstu1);
insert_link(&head,(struct LinkNode*)pteacher1);


或者方案2,更安全一些:
struct LinkNode
{
    void* data;
    struct LinkNode* next;
};

真实的数据由data指向。

或者方案3,教材上的方法,貌似扩展性很好,其实是很差……:

typedef struct Student elem_t;

struct LinkNode
{
    elem_t data;
    struct LinkNode* next;
};




但是无论如何,你的方法肯定是最差的,难维护,难调试,代码冗余。

[[it] 本帖最后由 StarWing83 于 2008-9-15 18:35 编辑 [/it]]

专心编程………
飞燕算法初级群:3996098
我的Blog
2008-09-15 18:34
StarWing83
Rank: 8Rank: 8
来 自:仙女座大星云
等 级:贵宾
威 望:19
帖 子:3951
专家分:748
注 册:2007-11-16
收藏
得分:0 
其实最好的方法是转向C++。设计模板类………………

但是,其实方案1就足够好了,模仿了C++的继承机制……

专心编程………
飞燕算法初级群:3996098
我的Blog
2008-09-15 18:36
wangjianlin2008
Rank: 1
来 自:四川
等 级:新手上路
帖 子:207
专家分:0
注 册:2008-6-22
收藏
得分:0 
回复 7# StarWing83 的帖子
你说得对 我这个是有些代码冗余,不过我是仿照其他数据库设计中设计表的方式设计的各个结构体,然而何何事情都是两面的,技术是没有你的那么高深,但对于初学不久的朋友们来说,可能这样的代码更容易理解!简单就是美嘛!

[[it] 本帖最后由 wangjianlin2008 于 2008-9-16 16:40 编辑 [/it]]

专注于计算机毕业课程设计源码
QQ:254540457
2008-09-16 15:21
zyc151174257
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2015-5-21
收藏
得分:0 
【顶礼膜拜●双鱼安康】
2015-05-21 14:27
快速回复:我在中秋节刚刚完成的c语言课程设计(成绩管理系统)源程序,免费发布出来 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.051343 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved