C语言编写的简单学生成绩管理系统方案

上传人:彩*** 文档编号:74801066 上传时间:2022-04-14 格式:DOCX 页数:14 大小:26.08KB
收藏 版权申诉 举报 下载
C语言编写的简单学生成绩管理系统方案_第1页
第1页 / 共14页
C语言编写的简单学生成绩管理系统方案_第2页
第2页 / 共14页
C语言编写的简单学生成绩管理系统方案_第3页
第3页 / 共14页
资源描述:

《C语言编写的简单学生成绩管理系统方案》由会员分享,可在线阅读,更多相关《C语言编写的简单学生成绩管理系统方案(14页珍藏版)》请在装配图网上搜索。

1、C语言编写的简单学生成绩管理系统C 语言编写的简单学生成绩管理系统#include stdio.h#include stddef.h#include stdlib.h#include conio.h /*屏幕操作函数*/#include string.h#define MAX 10typedef struct studentchar nameMAX;char numMAX;char sexMAX;int age;int chinese;int mathematic;int english;float aver;struct student *next;stu;stu *head;void pr

2、int() /*输出菜单 */textcolor(RED); /*设置文本显示颜色为红色*/textbackground(GREEN); /*设置背景颜色为绿色*/window(1,1,80,10); /*制作显示菜单的窗口*/clrscr();printf( n);printf( * welcome to use student manage *n);printf( * MENU *n);printf( * Enter Record ); /*录入信息 */printf( Statistics *n); /*显示成绩 */printf( * Quest ); /*查询 */printf( U

3、pdata *n); /*修改 */printf( * Save ); /*保存到磁盘 */printf(Display *n); /*统计成绩 */.printf( * Fresh ); /*刷新 */printf(Quit *n); /*退出系统 */printf( n);void cin(stu *p1) /*录入学生信息*/ printf(Enter name:n); scanf(%s,p1-name); printf(Enter num:n); scanf(%s,p1-num); printf(Enter sex:n); scanf(%s,&p1-sex); printf(Enter

4、 age:n); scanf(%d,&p1-age); printf(Enter score:n); printf(Enter chinese:n); scanf(%d,&p1-chinese); printf(Enter math:n); scanf(%d,&p1-mathematic); printf(Enter English:n); scanf(%d,&p1-english);p1-aver=(p1-chinese+p1-mathematic+p1-english)/3.0; /*平均分 */void cindata() /*是否继续录入*/ stu *p1,*p2; int i=1;

5、 char ch;head=(stu *)malloc(sizeof(stu);p1=head; /*头指针 */while(i)cin(p1);printf(Do you Want to Continue?yes or no:);ch=getchar();.ch=getchar();if(ch=n|ch=N) i=0;p1-next=NULL;else p2=p1;p1=(stu *)malloc(sizeof(stu);p2-next=p1;void lookdata(stu *p1) /*输出所有信息*/ printf(-n);while(p1!=NULL) printf(Num:%s

6、,p1-num); printf(Name:%s ,p1-name); printf(Sex:%s ,p1-sex); printf(Age:%d ,p1-age);/* printf(n); */ printf(Chinese:%d ,p1-chinese); printf(Math:%d ,p1-mathematic); printf(English:%d ,p1-english); printf(Average:%fn,p1-aver);printf(-n);p1=p1-next;printf(-n);/* 已经完成的任务:1. 录入保存磁盘2. 按姓名学号查询3. 输出成绩表4. 修改

7、处理5. 统计学生成绩*/void find1(stu *p2) /*按姓名查找信息*/ char name20;.int b=0;printf(Enter the name of the student you want to find:);scanf(%s,name);while(p2!=NULL)if(strcmp(name,p2-name)=0)printf(The data you want has be foundn);printf(-n);printf(Num:%st,p2-num);printf( Name:%st,p2-name);printf(sex:%st,p2-sex)

8、;printf(age:%dt,p2-age);printf(n);printf(Chinese:%dt,p2-chinese);printf(Math:%dt,p2-mathematic);printf(English:%dt,p2-english);printf(Average:%fn,p2-aver);printf(*n);b=1;p2=p2-next;if(b=1)printf(Find onen);elseprintf(Not findn);void find2(stu *p2) /*按学号查找信息*/ char numMAX; int b=0;printf(Enter the nu

9、m of the student you want to find:); scanf(%s,&num);while(p2!=NULL). if(strcmp(num,p2-num)=0) printf(The data you want has be foundn);printf(-n);printf(Num:%st,p2-num);printf( Name:%st,p2-name);printf(Sex:%st,p2-sex);printf(Age:%dt,p2-age);printf(n);printf(Chinese:%dt,p2-chinese);printf(Math:%dt,p2-

10、mathematic);printf(English:%dt,p2-english);printf(Average:%fn,p2-aver);printf(*n);b=1;p2=p2-next;if(b=1)printf(Find onen);elseprintf(Not findn);void find() /*查询记录 */ int i;printf(Find with name Find with num Returnn);printf(Please Enter your choice:);scanf(%d,&i);switch(i) case 1: find1(head); break

11、; case 2: find2(head); break;.case 3:return;void update1(stu *p2) /*按姓名修改 */char name10;int b=0;printf(Enter The Name: );scanf(%s,name);while(p2!=NULL) if(strcmp(name,p2-name)=0) printf(Find you data!n);printf(Enter the new name:);scanf(%s,p2-name);printf(Enter the num:);scanf(%s,p2-num);printf(Ente

12、r the sex:);scanf(%s,p2-sex);printf(Enter the age:);scanf(%d,&p2-age);printf(Enter the chinese score:);scanf(%d,&p2-chinese);printf(Enter the math score:);scanf(%d,&p2-mathematic);printf(Enter the english score:);scanf(%d,&p2-english);p2-aver=p2-chinese+p2-mathematic+p2-english;printf(Success!n);b=1

13、;p2=p2-next;if(b=0).printf(Sorry not Find data!n);elseprintf(Finish!n);void update2(stu *p2) /*按学号修改 */char numMAX;int b=0;printf(Enter The Num: );scanf(%s,&num);while(p2!=NULL) if(strcmp(num,p2-num)=0) printf(Find you data!n); printf(Enter the new name:); scanf(%s,p2-name); printf(Enter the num:);

14、scanf(%s,p2-num); printf(Enter the sex:); scanf(%s,p2-sex); printf(Enter the age:); scanf(%d,&p2-age); printf(Enter the chinese score:); scanf(%d,&p2-chinese); printf(Enter the math score:);scanf(%d,&p2-mathematic);printf(Enter the english score:);scanf(%d,&p2-english);p2-aver=(p2-chinese+p2-mathema

15、tic+p2-english)/3.0;printf(Success!n);b=1;p2=p2-next;.if(b=0)printf(Sorry not Find data!n);elseprintf(Finish!n);void update() /*修改记录 */ int i;printf(Updata with name Updata with num Returnn);printf(Please Enter your choice:);scanf(%d,&i);switch(i) case 1:update1(head);break;case 2:update2(head);brea

16、k;case 3:return;void saved(stu *p2) /*保存到磁盘student.dat文件中 */FILE *fp;char file16=c:student.dat;char file1=num-name-sex-age-chinese-math-english-avern;if(fp=fopen(file,wt)=NULL) printf(nCannot open the file !n); return;fprintf(fp,%s,file1);while(p2!=NULL). fprintf(fp,%s-,p2-num); fprintf(fp,%s-,p2-na

17、me);fprintf(fp,%s-,p2-sex);fprintf(fp,%d-,p2-age);fprintf(fp,%d-,p2-chinese);fprintf(fp,%d-,p2-mathematic);fprintf(fp,%d-,p2-english);fprintf(fp,%fn,p2-aver);p2=p2-next;fclose(fp);printf(Saved successed!);void statistics(stu *p2) /*统计学生成绩 */ FILE *fp,*fp1;char file16=c:stufile.dat,file116=c:stugood.

18、dat;if(fp=fopen(file,wt)=NULL) printf(nCannot open the file !n); return;if(fp1=fopen(file1,wt)=NULL) printf(nCannot open the file !n); return;while(p2!=NULL) if(p2-chineseenglishmathematicnum);fprintf(fp,%s-,p2-name);fprintf(fp,%s-,p2-sex);fprintf(fp,%d-,p2-age);fprintf(fp,%d-,p2-chinese);fprintf(fp

19、,%d-,p2-mathematic);fprintf(fp,%d-,p2-english);fprintf(fp,%fn,p2-aver);.p2=p2-next;else if(p2-chinese=90)&(p2-english=90)&(p2-mathematic=90) fprintf(fp1,%s-,p2-num); fprintf(fp1,%s-,p2-name); fprintf(fp1,%s-,p2-sex); fprintf(fp1,%d-,p2-age); fprintf(fp1,%d-,p2-chinese); fprintf(fp1,%d-,p2-mathematic

20、); fprintf(fp1,%d-,p2-english);fprintf(fp1,%fn,p2-aver);p2=p2-next;elsep2=p2-next;fclose(fp);fclose(fp1);printf(Saved successed!);void print1() system(cls); /*清除整个屏幕*/void display2() /*显示不及格记录*/ FILE *fp; if(fp=fopen(c:STUFILE.DAT,r)=NULL) printf(Cannot open the file!);return;while(!feof(fp) putchar

21、(fgetc(fp);printf(bSuccess!n);.void display3() /*显示 90 分以上同学的记录*/ FILE *fp;if(fp=fopen(c:STUGOOD.DAT,r)=NULL) printf(Cannot open the file!); return;while(!feof(fp) putchar(fgetc(fp);printf(bSuccess!n);void display() /*显示记录 */ int i;printf(Display All Display Good Display Flunkn);printf(Plasce Enter

22、your choice:);scanf(%d,&i);switch(i) case 1: lookdata(head); break;case 2: display3(); break; case 3: display2(); break;void interface() /*启动界面 */clrscr();window(20, 5, 60, 15);.textattr(BLUE+(LIGHTGRAY4);clrscr();cputs(nn Welcome to use student manage system! );cputs( Maker: zhangwantong );cputs( C

23、lass: 04-5 );cputs( Edit : V1.0 );cputs( Press ENTER key .);while(getchar()!=n) ;return;void interface2() /*退出界面 */print1();window(20, 5, 60, 15);textattr(128+BLUE+(LIGHTGRAY4);clrscr();cputs(nn & Thanks for you used! & n);cputs( Maker: zhangwantong );cputs( Class: 04-5 );cputs( Edit : V1.0 );cputs(

24、 Press ENTER key .);while(getchar()!=n) ;return;void main() int choice; int i;stu *p2; interface(); print1();.print();while(1)printf(Enter your choice:);scanf(%d,&i);while(i8) printf(Enter num from 1 to 8:n); printf(Enter your choice:); scanf(%d,&i);switch(i) case 1: cindata(); break; case 2: statistics(head); break;case 3:find();break;case 4:update();break;case 5:saved(head);break;case 6:display();break;case 7:print1();print();break;case 8:interface2();.exit(1);break; printf(Input ENTER to continue:);getchar();while(getchar()!=n) ;system(cls);print();.

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!