1、C语言学生管理系统#include #include #include #include #define M 50const char strStudentFilePath = studentInfo.txt;const char strCourseFilePath = courseInfo.txt;typedef struct MyInt int num; struct MyInt *next;CourseNumList, ScoreList;struct student int num; char name20; char sex; CourseNumList* courseNumList
2、; /存放的是课程的序号 ScoreList* courseScore; /与上一个列表相对应的课程的成绩 int courseSize; int ave;stuM;typedef struct student Student;int stuNum; /系统中存在的学生的记录数typedef struct Course int numCourse; char name20; char teacherName20; struct Course *next;CourseList;CourseList *pCourse = NULL; /头指针CourseList *currentPoint = N
3、ULL; /工作指针/* 函数名:Initialize 作用:初始化系统的显示标头 参数: 返回值:*/void Initialize() printf(tt*nn); printf(tt学生成绩管理系统-C语言版 n); printf(n); printf(tt CopyRight Maode,YAN n); printf(n); printf(tt*nn);/* 函数名:Exit 作用:当系统需要退出时,调用此函数停屏,与使用者交互 参数: 返回值:*/void Exit() printf(input any key to quit!); getch(); exit(0);void Sav
4、e();/* 函数名:InputStudentInfo 作用:输入学生信息,并保存在内存中 参数: 返回值: 创建日期:2012-05-13 By Maode,Yan*/void InputStudentInfo() int i; char isSave; printf(n开始输入学生信息,建立学生信息表:n); printf(请输入学生人数:); scanf(%d, &stuNum); if (stuNum M) printf(输入的学生数超过人数上线!系统退出!); Exit(); for(i = 0; i stuNum; i+) printf(请输入第%d个学生的学号:n, i); sc
5、anf(%d, &stui.num); printf(请输入第%d个学生的姓名:n, i); scanf(%s, stui.name); fflush(stdin); printf(请输入第%d个学生的性别(Y代表男,N代表女):n, i); scanf(%c, &stui.sex); stui.courseNumList = NULL; stui.courseScore = NULL; stui.courseSize = 0; stui.ave = 0; fflush(stdin); printf(是否保存学生信息到文件?Y:保存,N:不保存:); scanf(%c, &isSave); i
6、f (isSave = Y | isSave = y) Save(0); /0代表保存的是学生信息 printf(保存学生信息到文件操作已经完成!); else fflush(stdin); printf(选择不保存!学生信息是系统运行基础,您确认不保存直接退出?Y:保存, N:不保存:); scanf(%c, &isSave); if (isSave != Y & isSave != y) exit(0); else Save(0); printf(保存课程信息到文件操作已经完成!); /* 函数名:ShowOneStudentInfoWithoutScores 作用:输出学生信息,不包括成
7、绩,仅仅有学号,名字和性别三个信息 参数:带输出学生的学号 返回值:*/void ShowOneStudentInfoWithoutScores(int StudentNum) int k; int i = StudentNum; int leaveRoom; char temp8; memset(temp, 0, 8); ltoa(stui.num, temp, 10); leaveRoom = 6 - strlen(temp); printf(%d, stui.num); for (k = 0; k leaveRoom; k+) printf( ); memset(temp, 0, 8);
8、 leaveRoom = 0; leaveRoom = 8 - strlen(stui.name); printf(%s, stui.name); for (k = 0; k leaveRoom; k+) printf( ); leaveRoom = 0; if (Y = stui.sex | y = stui.sex) printf(男); else printf(女); for (k = 0; k numCourse); fflush(stdin); printf(请输入课程名称:n); scanf(%s, newPoint-name); fflush(stdin); printf(请输入任课教师名称:n); scanf(%s, newPoint-teacherName); if (NULL = pCourse) currentPoint = newPoint;
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1