课程设计实验报告 李锐
printf(\请输入姓名:\ scanf(\
printf(\请输入语文:\ scanf(\ printf(\请输入数学:\ scanf(\
printf(\请输入英语:\ scanf(\ printf(\请输入C语言:\ scanf(\
printf(\*********\\n\
if(pStu->pnext == NULL) //说明链表里面一个数据都没有 {
pnew->pnext = NULL; pStu->pnext = pnew; }
else //说明有数据 {
ptemp = pStu;
while(ptemp != NULL) {
if(ptemp->pnext != NULL) {
if(pnew->num > ptemp->num && pnew->num < ptemp->pnext->num) {
pnew->pnext = ptemp->pnext; ptemp->pnext = pnew; break; } } else {
pnew->pnext = NULL; ptemp->pnext = pnew; break; }
ptemp = ptemp->pnext; }
31
课程设计实验报告 李锐
}
printf(\*********\\n\
printf(\\\n\
printf(\信息添加成功! \\n\
printf(\\\n\
printf(\*********\\n\ }
printf(\*********\\n\
printf(\\\n\
printf(\按“任意键”返回上一层界面... \\n\
printf(\\\n\
printf(\*********\\n\ getch(); }
9.保存数据函数: void savedata() {
STU *ptemp = pStu->pnext;
system(\
fp=fopen(filename,\
if(fp == NULL) {
printf(\文件打开失败!\ }
else {
while(ptemp != NULL) {
32
课程设计实验报告 李锐
fprintf(fp,\mp->num,ptemp->name,ptemp->chinese,ptemp->math,ptemp->english,ptemp->computer,ptemp->sum,ptemp->rank);
ptemp = ptemp->pnext; } }
fclose(fp);
printf(\*********\\n\
printf(\\\n\
printf(\保存信息成功! \\n\
printf(\\\n\
printf(\按“任意键”返回上一层界面... \\n\
printf(\\\n\
printf(\*********\\n\
getch(); }
10.加密函数: void mima() {
int mima;
system(\ printf(\
printf(\*********\\n\
printf(\\\n\
printf(\\\n\
33
课程设计实验报告 李锐
printf(\学生成绩管理系统 \\n\
printf(\\\n\
printf(\\\n\
printf(\*********\\n\
printf(\\\n\
printf(\\\n\
printf(\请输入教师系统密码: \\n\
printf(\(默认密码:123) \\n\
printf(\\\n\
printf(\\\n\
printf(\温馨提示:教师系统密码由教务处设定,教师无权限修改! \\n\
printf(\\\n\
printf(\\\n\
printf(\*********\\n\
printf(\
if(mima != 123) {
printf(\*****\\n\
printf(\\\n\
printf(\密码错误!若忘记密码请联系教务处! \\n\
printf(\\\n\
34
课程设计实验报告 李锐
printf(\*****\\n\
exit(0); }
fflush(stdin);
printf(\*********\\n\
printf(\\\n\
printf(\登陆成功! \\n\
printf(\\\n\
printf(\按回车键继续... \\n\
printf(\\\n\
printf(\*****\\n\
getch(); }
11.修改学生的信息(按照学号)函数: void editstu1(STU *ptemp) {
int num; float score; int sub;
system(\ printf(\
printf(\*********\\n\
printf(\\\n\
printf(\\\n\
printf(\学生成绩管理系统
35