1、c+大作业学生信息管理系统源代码学生信息管理系统源代码:struct studentchar num30; int maths; char name30; int chinese;char clas30; int english; int total; float average; student *next;/1(1)void createlist(student * & head) /学生成绩文件导入功能(用链表储存)char t80,num030,name030,clas030;int chinese0,maths0,english0;student *s,*p;if (!instuf)
2、 cerrfile could not be open.num0name0clas0chinese0maths0english0) s=new student; strcpy(s-num,num0);strcpy(s-name,name0);strcpy(s-clas,clas0); s-chinese=chinese0;s-maths=maths0;s-english=english0; s-total=s-chinese+s-maths+s-english; s-average=float(s-total)/3; if (head=NULL) head=s; else p-next=s;
3、p=s;p-next=NULL;/1(2)void showlist(student *head) /学生成绩信息显示功能(遍历链表) int n=1; cout学号 姓名 班级 语文 数学 英语 总分 均分 序号 ; while (head) coutnum nametclast chineset mathstenglishttotaltsetprecision(3)averaget nnext; /2void charu(student *head) /学生成绩信息插入功能(链表尾部插入学生成绩信息) student *s,*p,*q; int n,i; coutn; cout请输入需插入
4、的学生成绩信息(每人一行):endl; cout学号 姓名 班级 语文 数学 英语next; for (i=1;is-nums-names-class-chineses-mathss-english; s-total=s-chinese+s-maths+s-english; s-average=float(s-total)/3; q-next =s; q=s; q-next=NULL;/3void shanchu(student * & head) /学生成绩信息删除功能 student *p,*q; char a30; int n,i,b=1; coutn; cout请输入需要删除的学生的学
5、号或姓名:endl; for (i=1;ia; if (strcmp(head-num,a)=0)|(strcmp(head-name,a)=0) b=0; p=head; head=head-next; delete p; p=NULL; else p=head; while (p-next!=NULL)&(strcmp(p-next-num,a)!=0)&(strcmp(p-next-name,a)!=0) p=p-next; if (p-next!=NULL) b=0; q=p-next; p-next=q-next; delete q; q=NULL; if (b=1) cout无此学
6、号或姓名的成绩记录!endl;/4void change(student *head) /学生成绩信息的修改功能(修改指定学生信息) char a30; int b=1; couta; while (head) if (strcmp(head-num,a)=0)|(strcmp(head-name,a)=0) coutendl; b=0; cout此学生原来的学生成绩信息是:endl; cout学号 姓名 班级 语文 数学 英语endl; coutnum nametclast chinesetmathstenglishendl; cout请输入修改后的学生成绩信息:endl; cout学号 姓
7、名 班级 语文 数学 英语head-numhead-namehead-clashead-chinesehead-mathshead-english; head-total=head-chinese+head-maths+head-english; head-average=float(head-total)/3; head=head-next; if (b=1) cout无此学号或姓名的成绩记录!endl;/5(1)void geren(student *head) /查询个人成绩功能 char a30; int b=1; couta; cout此学生的学生成绩信息是:endl; cout学号
8、 姓名 班级 语文 数学 英语 总分 均分num,a)=0)|(strcmp(head-name,a)=0) b=0; coutnum nametclast chineset mathstenglishttotaltsetprecision(3)averagenext; if (b=1) cout无此学号或姓名的成绩记录!endl;/5(2)void chabanji(student *head) /查询班级成绩功能 char a30; int b=1; couta; cout此班级的学生成绩信息是:endl; cout学号 姓名 班级 语文 数学 英语 总分 均分clas,a)=0) b=0
9、; coutnum nametclast chineset mathstenglishttotaltsetprecision(3)averagenext; if (b=1) cout无此班级的成绩记录!endl;/5(3)void chayuwen(student *head) /查询语文成绩功能 int h,l,b=1; cout请输入您要查询的【语文】成绩的分数段: endl; cout起始分 终止分l; cinh; cout此分数段的学生语文成绩信息是:endl; cout学号 姓名 班级 语文 数学 英语 总分 均分chinese=l)&(head-chinese=h) b=0; co
10、utnum nametclast chineset mathstenglishttotaltsetprecision(3)averagenext; if (b=1) cout无此分数段的语文成绩记录!endl;/5(4)void chashuxue(student *head) /查询数学成绩功能 int h,l,b=1; cout请输入您要查询的【数学】成绩的分数段: endl; cout起始分 终止分l; cinh; cout此分数段的学生数学成绩信息是:endl; cout学号 姓名 班级 语文 数学 英语 总分 均分maths=l)&(head-maths=h) b=0; coutnu
11、m nametclast chineset mathstenglishttotaltsetprecision(3)averagenext; if (b=1) cout无此分数段的数学成绩记录!endl;/5(5)void chayingyu(student *head) /查询英语成绩功能 int h,l,b=1; cout请输入您要查询的【英语】成绩的分数段: endl; cout起始分 终止分l; cinh; cout此分数段的学生英语成绩信息是:endl; cout学号 姓名 班级 语文 数学 英语 总分 均分english=l)&(head-english=h) b=0; coutnu
12、m nametclast chineset mathstenglishttotaltsetprecision(3)averagenext; if (b=1) cout无此分数段的英语成绩记录!endl;/5(6)void chazongfen(student *head) /查询总分成绩功能 int h,l,b=1; cout请输入您要查询的【总分】成绩的分数段: endl; cout起始分 终止分l; cinh; cout此分数段的学生总分成绩信息是:endl; cout学号 姓名 班级 语文 数学 英语 总分 均分total=l)&(head-total=h) b=0; coutnum n
13、ametclast chineset mathstenglishttotaltsetprecision(3)averagenext; if (b=1) cout无此分数段的总分成绩记录!next; while (q) if (p-chinesechinese) strcpy(a,p-num);strcpy(p-num,q-num);strcpy(q-num,a); strcpy(a,p-name);strcpy(p-name,q-name);strcpy(q-name,a); strcpy(a,p-clas);strcpy(p-clas,q-clas);strcpy(q-clas,a); b=
14、p-chinese;p-chinese=q-chinese;q-chinese=b; b=p-maths;p-maths=q-maths;q-maths=b; b=p-english;p-english=q-english;q-english=b; b=p-total;p-total=q-total;q-total=b; c=p-average;p-average=q-average;q-average=c; q=q-next; p=p-next; /6(2)void shuxue(student *head) /按数学成绩从高到低排序功能 student *p,*q; char a30; i
15、nt b; float c; p=head; while (p) q=p-next; while (q) if (p-mathsmaths) strcpy(a,p-num);strcpy(p-num,q-num);strcpy(q-num,a); strcpy(a,p-name);strcpy(p-name,q-name);strcpy(q-name,a); strcpy(a,p-clas);strcpy(p-clas,q-clas);strcpy(q-clas,a); b=p-chinese;p-chinese=q-chinese;q-chinese=b; b=p-maths;p-maths
16、=q-maths;q-maths=b; b=p-english;p-english=q-english;q-english=b; b=p-total;p-total=q-total;q-total=b; c=p-average;p-average=q-average;q-average=c; q=q-next; p=p-next; /6(3)void yingyu(student *head) /按英语成绩从高到低排序功能 student *p,*q; char a30; int b; float c; p=head; while (p) q=p-next; while (q) if (p-e
17、nglishenglish) strcpy(a,p-num);strcpy(p-num,q-num);strcpy(q-num,a); strcpy(a,p-name);strcpy(p-name,q-name);strcpy(q-name,a); strcpy(a,p-clas);strcpy(p-clas,q-clas);strcpy(q-clas,a); b=p-chinese;p-chinese=q-chinese;q-chinese=b; b=p-maths;p-maths=q-maths;q-maths=b; b=p-english;p-english=q-english;q-en
18、glish=b; b=p-total;p-total=q-total;q-total=b; c=p-average;p-average=q-average;q-average=c; q=q-next; p=p-next; /6(4)void zongfen(student *head) /按总分成绩从高到低排序功能 student *p,*q; char a30; int b; float c; p=head; while (p) q=p-next; while (q) if (p-totaltotal) strcpy(a,p-num);strcpy(p-num,q-num);strcpy(q
19、-num,a); strcpy(a,p-name);strcpy(p-name,q-name);strcpy(q-name,a); strcpy(a,p-clas);strcpy(p-clas,q-clas);strcpy(q-clas,a); b=p-chinese;p-chinese=q-chinese;q-chinese=b; b=p-maths;p-maths=q-maths;q-maths=b; b=p-english;p-english=q-english;q-english=b; b=p-total;p-total=q-total;q-total=b; c=p-average;p
20、-average=q-average;q-average=c; q=q-next; p=p-next; /7void xuehao(student *head) /按学号从小到大排序功能 student *p,*q; char a30; int b; float c; p=head; while (p) q=p-next; while (q) if (strcmp(p-num,q-num)0) strcpy(a,p-num);strcpy(p-num,q-num);strcpy(q-num,a); strcpy(a,p-name);strcpy(p-name,q-name);strcpy(q-
21、name,a); strcpy(a,p-clas);strcpy(p-clas,q-clas);strcpy(q-clas,a); b=p-chinese;p-chinese=q-chinese;q-chinese=b; b=p-maths;p-maths=q-maths;q-maths=b; b=p-english;p-english=q-english;q-english=b; b=p-total;p-total=q-total;q-total=b; c=p-average;p-average=q-average;q-average=c; q=q-next; p=p-next; /8voi
22、d xingming(student *head) /按姓名首字母排序功能 student *p,*q; char a30; int b; float c; p=head; while (p) q=p-next; while (q) if (strcmp(p-name,q-name)0) strcpy(a,p-num);strcpy(p-num,q-num);strcpy(q-num,a); strcpy(a,p-name);strcpy(p-name,q-name);strcpy(q-name,a); strcpy(a,p-clas);strcpy(p-clas,q-clas);strcpy(q-clas,a); b=p-chinese;p-chinese=q-chinese;q-chinese=b; b=p-maths;p-maths=q-maths;q-math
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1