链表版成绩管理系统

上传人:gg****m 文档编号:213087994 上传时间:2021-11-21 格式:DOC 页数:24 大小:216.50KB
返回 下载 相关 举报
链表版成绩管理系统_第1页
第1页 / 共24页
链表版成绩管理系统_第2页
第2页 / 共24页
链表版成绩管理系统_第3页
第3页 / 共24页
链表版成绩管理系统_第4页
第4页 / 共24页
链表版成绩管理系统_第5页
第5页 / 共24页
点击查看更多>>
资源描述

《链表版成绩管理系统》由会员分享,可在线阅读,更多相关《链表版成绩管理系统(24页珍藏版)》请在金锄头文库上搜索。

1、这个管理系统还有一些东西可以等大家完善,并且简单易懂。 #include #include #inelude #inelude vconio.h#include #inelude #inelude /typedef struct stude ntint num;char name10;char sex6;float china;float muth;float english;float sum;float average;struct student *next;stu;/void Chakanmenu();void passwordCheck();/密码系统struct student*

2、startCheckf);开始void gotoxy(int x, int y);/x 为列坐标,y 为行坐标void menu();/主菜单struct student* insert();/创建链表,并输入数据struct student* Charu(stu* head);向链表中插入数据struct student* Delete(stu* head);/删除链表中数据struct student* Xuigai(stu* head);/修改链表中数据 struct student* readfile();将文件中信息读取到链表中 void savelist(stu *phead);/

3、将处理后的链表保存到文件 void savefstu* phead);/将链表中数据保存到文件中 /void jiaohuan(stu *p,stu *q)int n;float c,rrbe,s,a;char name10,sex6;n 二 qnum;qnu m=p-num; p-num二n;c=q-chi na;q chi na 二 p-chi na; p-chi na 二 c;m=p-muth; p-muth=q-muth;q-muth=m; e=q-e nglish; q-english=p-e nglish; p-e nglish=e;s=q-sum; q-sum=p-sum; p-

4、sum=s;a=q-average; q-average=p-average;p-average=a;strcpy(n ame);strcpy(q-n ame,p-n ame); strcpy(p- name, name); strcpy(sex,q-sex); strcpy(q-sex,p-sex);strcpy(p-sex,sex);/struct student* Xuepaixu(stu *head)int count=l,i,j;stu *p,*q;p=q=head;while(p-next!=NULL)coun t+;p=p-n ext; for(i=l;ico un t;i+)f

5、or(j=0;jnumnext-num) jiaohua n(q,q-next); q 二 qn ext;q=head;return (head);/struct student* Zongpaixu(stu *head)int count=l,i,j;stu *p,*q;p=q=head;while(p-next!二NULL)coun t+;p=p-n ext;for(i=l;ico un t;i+)for(j=0;jsum ne xt-sum)jiaohua n(q ,q-next);q二qn ext;q=head;return (head);/struct student* Pingpa

6、ixu(stu *head)int count=l,i,j;stu *p,*q;p=q=head;while(p-next!=NULL)coun t+;p=p-n ext;for(i=l;icount;i+)for(j=0;javeragenext-average) jiaohua n(q ,q-next);q二qnext;q=head;return (head);/void savelistfstu *phead)FILE *fp;fp=fopen(data.datJ,w);while(phead!=NULL)fprintf(fp,“n“);fprintf(fp,%d %s %s %.2f

7、%.2f %.2f %.2f %.2f,phead-num,phead-name,phead-sex,phead-ch in azphead muth,phead-english,phead-sum,phead-average);phead=phead-next;fclose(fp);/struct student* readfilef)stu *phead=NULL,*p;FILE* fp;if(fp=fopen(,data.dat,/,rb)=NULL)fclose(fp);return (phead);elsep=(struct student*)malloc(sizeof(struct

8、 student);fscanf(fp,”d %s %s %f %f %f %f %f,&p-num,p-narne,p-sex,&p-china,&p-muth,&p-englis h,&p-sum,&p-average);phead=p;while(fgetc(fp)!=EOF)p-next=(struct student*)malloc(sizeof(struct student);p=p next;fscanfffp/d %s %s %f %f %f %f %化&p-num,p-name,p-sex,&p-china,&p-muth,&penglis h,&p-sum,&paverag

9、e);讦(0(p-muth)| | (p-muth)100)break;pn ext=NULL;fclose(fp);return (phead);/void Shuchu(stu* head)systemCCLS);if(head=NULL)printf(ttt你还没有录入学生信息,即将返回主菜单“);Sleep(2000);menu();elseint i,count=0;printf(nn i111111r1 n);printfCAn |学号|姓名|性别|语文|数学|英语|平均分|总 分 I nn);while(head!=NULL)printfC | %-5d | %-6s |%2s

10、| %5.1f | %5.1f | %5.1f | %5.1f | %5.1fIn ,head-num,head-n ame,head-sex,head-chi na,head-muth,head-e nglish,head-average,h ead-sum);head=head n ext;coun t+;printfC 111111111 n);printfC在线人数:dn“,count);printfC返回主菜单按任意键”);scanfcr:&i);;/void passwordCheck()char password20, inputword20;jnt i = 0, j = 0;c

11、har c = 0;FILE *fp = fopenCpassword.dat蔦 HrbH);systemCtitle学生成绩统讣系统密码输入“);/将标题栏命名为“学生成绩统讣系统” fread(password, 20,1, fp);for (i = 0; i 3; i+)j = 0;printf(Hnnntt你还有d次机会输入正确密码:“,3-i);printf(nnnnttt i1 nH);printf(ttt II n);printf(Httt 11 n);gotoxy(26, 8);while (c = getch() != 13 & j 0)putchar(b);putchar(

12、);putchar(b);j-;elseif (isprint(c)/isprint为检测C是否为可打印的函数putchar(*);in putwordj = c;j卄;inputwordj = 0;if (strcmp(inputword, password) = 0)return;elsesystem(,CLS,); printf(ttt密码输入错误“);if (3 =i)systemCLS”);printf(nnntt你已浪费所有机会!程序即将退出! “);Sleep(2000);exit(O);fclose(fp);systemCCLS);/struct student *startC

13、heck(void)FILE *fpl;char password20 = 666666;int i;if (fpl = fopen(password.datz rb) = NULL)/若密码文件不存在,新建密码文件 fpl = fopenfpassword.dat, wb);fwrite(password, 20,1, fpl);fclose(fpl);printf(”密码初始化完成!(默认密码为:666666);passwordCheck();elsepasswordCheck();读条system(CLS);systemCtitle学生成绩统计系统载入中“);将标题栏命名为“学生成绩统计系统” printf(Hnnttt欢迎进入本系统!正在载入.”);1 nH);I nM);J n)

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号