2022年学生选课系统及学籍管理归类 .pdf
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《2022年学生选课系统及学籍管理归类 .pdf》由会员分享,可在线阅读,更多相关《2022年学生选课系统及学籍管理归类 .pdf(16页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、综合设计题目 :学籍管理及选课系统课程名称: C 语言高级程序及设计学院 :自动化专业班级: 12电力 4 班学号:姓名:郑程鹏联系方式:任课老师:王星华2014 年 12 月 3 日名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 16 页 - - - - - - - - - #include #include #include int courcenum,studentnum; / 课程的结构体struct cource int num,credit,maxnum,se
2、lectednum; char courceName30; struct cource * next; cource; / 学生的结构体struct student char studentname20; int selectednum,selectedcredit,num; int cource10; struct student * next; student; / 指针链表的头struct cource * courcehead; struct student * studenthead; int j; void main() void getcource(); void getstud
3、ent(); int i;/ 作为获取用户的输入的变量getcource();/ 从文件中读取已保存的课程数据getstudent();/ 从文件中读取已保存的学生数据system(cls); run: for(j =0;j 80;j+) printf(*); printf(nnn1.查看课程); printf(2. 查看管理学生); printf(3. 查看选课); printf(4. 选课情况); printf(5. 退出系统nnn); for(j =0;j 80;j+) printf(*); printf( 请输入您的选择:); 名师资料总结 - - -精品资料欢迎下载 - - - -
4、- - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 16 页 - - - - - - - - - scanf(%d,&i); if(i 5) printf( 输入有误 n); goto run; if(i = 1) system(cls);/ 清屏函数,清楚屏幕所有的东西viewcource();/ 查看课程的函数goto run; else if(i = 2) system(cls); manage();/ 管理学生的函数goto run; else if(i = 3) system(cls); xuankecaidan();/
5、选课的函数goto run; else if(i = 4) system(cls); sortstudent();/ 查看选课情况的函数goto run; else if(i = 5) system(cls); void getcource() FILE * fp; struct cource *p1,*p2; courcenum=0; char filepath = cource.txt;/默认 txt 文件在当前目录下名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 1
6、6 页 - - - - - - - - - if(fp=fopen(filepath,r)=NULL)/以只读的方式打开文件 / 无法打开文件的时候printf(error to find cource file%s!n,filepath); exit(0); / 生成 struct cource 大小的内存并让p1,p2 指向p1=p2=(struct cource*)malloc(sizeof(struct cource); / 从文件中读取fscanf(fp,%d%s%d%d%d,&p1-num,p1-courceName,&p1-credit,&p1-maxnum,&p1-select
7、ednum); courcehead=NULL; while(!feof(fp)/循环读取直到读到文件结尾 courcenum=courcenum+1; / 读取第一个课程的时候情况不同if(courcenum=1) courcehead=p1; else p2-next=p1; p2=p1; p1=(struct cource * )malloc(sizeof(struct cource); fscanf(fp,%d%s%d%d%d,&p1-num,p1-courceName,&p1-credit,&p1-maxnum,&p1-selectednum); p2-next=NULL; void
8、 getstudent() char bianhao20; char * fgzf = ; char * cba; int i; FILE * fp; struct student *p1,*p2; courcenum=0; char filepath = student.txt; if(fp=fopen(filepath,r)=NULL) printf(error to find student file%s!n,filepath); exit(0); p1=p2=(struct student*)malloc(sizeof(struct student); 名师资料总结 - - -精品资料
9、欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 16 页 - - - - - - - - - fscanf(fp,%d%s%d%s%d,&p1-num,p1-studentname,&p1-selectednum,bianhao,&p1-selectedcredit); cba=strtok(bianhao,fgzf);/char *strtok(char s, const char *delim);分解字符串为一组字符串。 s为要分解的字符串,delim 为分隔符字符串。i=0; while(cba)
10、 p1-courcei=change(cba); cba=strtok(NULL,fgzf); i+; studenthead=NULL; while(!feof(fp) studentnum=studentnum+1; if(studentnum=1) studenthead=p1; else p2-next=p1; p2=p1; p1=(struct student * )malloc(sizeof(struct student); fscanf(fp,%d%s%d%s%d,&p1-num,p1-studentname,&p1-selectednum,bianhao,&p1-selecte
11、dcredit); cba=strtok(bianhao,fgzf); i=0; while(cba) p1-courcei=change(cba); cba=strtok(NULL,fgzf); i+; p2-next=NULL; int change(char *str) int v=0; do v=10*v+*str-0; str+; while(*str=0)&(*strnum,c-courceName,c-credit,c-maxnum,c-selectednum); c=c-next; fclose(fp); void setstudent() FILE * fp; struct
12、student * s; char filepath = student.txt; if(fp=fopen(filepath,w)=NULL) printf(nnot save); exit(0); char fgzf2=; int i; s=studenthead; while(s!=NULL & s-num!=NULL) char outcource15=; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 16 页 - - - - - - - - - for(i=0;
13、iselectednum;i+) char temp20; if(i=0) itoa(s-courcei,temp,10); strcat(outcource,temp); else strcat(outcource,fgzf); itoa(s-courcei,temp,10); strcat(outcource,temp); if(s-selectednum=0) strcat(outcource,0); fprintf(fp,%dt%st%dt%st%dn,s-num,s-studentname,s-selectednum,outcource,s-selectedcredit); s=s-
14、next; fclose(fp); printf(okn,filepath); void save() setcource(); setstudent(); void viewstudent() struct student * s; char fgzf2=; int i; system(cls); s=studenthead; for(j =0;j num!=NULL) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 16 页 - - - - - - - - - cha
15、r outcource15=; for(i=0;iselectednum;i+) char temp20; if(i=0) itoa(s-courcei,temp,10); strcat(outcource,temp); else strcat(outcource,fgzf); itoa(s-courcei,temp,10); strcat(outcource,temp); printf(%-16d%-16s%-16d%-16s%-10dn,s-num,s-studentname,s-selectednum,outcource,s-selectedcredit); s=s-next; for(
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年学生选课系统及学籍管理归类 2022 学生 选课 系统 学籍 管理 归类
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内