学生综合测评系统.docx

上传人:b****5 文档编号:5237941 上传时间:2022-12-14 格式:DOCX 页数:32 大小:20.83KB
下载 相关 举报
学生综合测评系统.docx_第1页
第1页 / 共32页
学生综合测评系统.docx_第2页
第2页 / 共32页
学生综合测评系统.docx_第3页
第3页 / 共32页
学生综合测评系统.docx_第4页
第4页 / 共32页
学生综合测评系统.docx_第5页
第5页 / 共32页
点击查看更多>>
下载资源
资源描述

学生综合测评系统.docx

《学生综合测评系统.docx》由会员分享,可在线阅读,更多相关《学生综合测评系统.docx(32页珍藏版)》请在冰豆网上搜索。

学生综合测评系统.docx

学生综合测评系统

#include

#include"stdlib.h"

#include"string.h"

#include

structstudent*Read();

voidsave(structstudent*head);

voidsinput(structstudent*p);

structstudent*input();

voidpaixu_num(structstudent*head);

structstudent*insert();

structstudent*alter();

structstudent*del();

voidfind_num(structstudent*phead);

voidfind_name(structstudent*phead);

voidoutput();

voidmin_student(structstudent*phead);

voidmax_student(structstudent*phead);

voidave_student(structstudent*phead);

voidevery_student(structstudent*phead);

voidscore_paixu(structstudent*head);

voidhelp();

voidtj_menu(structstudent*head);

voidfind_menu(structstudent*head);

voidmenu();

structstudent{//定义学生信息结构数组,用于学生信息输入

charnumber[13];

charname[13];

charsex[4];

charadds[15];

charphone[14];

charqq[14];

floatchinese,math,english,txhp,pinde,teacher;

intzcmc,ksmc;

doubleave,zc;

structstudent*next;

};

#defineLensizeof(structstudent)

intlen;//链表长度

inta=0,b=0,c=0,d=0,e=0;//用来存放成绩各阶的人数

charstu[10];

structstudent*Read(){//读取数据文件保存到链表中,返回指向此链表头指针

structstudent*head=NULL;

structstudent*p1,*p2;

FILE*fp;

cout<<"请输入你要打开的文件(.dat)"<

cin>>stu;

if((fp=fopen(stu,"rb+"))==NULL)

{

cout<<"打开文件出错!

"<

exit(0);

}

while(!

feof(fp)){

if((p1=(structstudent*)malloc(Len))==NULL)

{

cout<<"内存申请出错"<

fclose(fp);

exit(0);

}

if(fread(p1,Len,1,fp)!

=1)

{

free(p1);

break;

}

if(head==NULL)

head=p2=p1;

else

{

p2->next=p1;

p2=p1;

}

}

fclose(fp);

returnhead;

}

voidsave(structstudent*head){//数据存盘

FILE*fp;

structstudent*p;

p=head;

cout<<"请输入你要存进去的文件(.dat)"<

cin>>stu;

if((fp=fopen(stu,"wb"))==NULL)

{

cout<<"无法打开文件!

"<

system("pause");

menu();

}

while(p)

{

if(fwrite(p,Len,1,fp)!

=1)

{

cout<<"写入数据出错"<

fclose(fp);

return;

}

else

p=p->next;

}

cout<<"数据存入成功!

请按任意键继续!

"<

getchar();

fclose(fp);

}

//单次输入

voidsinput(structstudent*p)

{

cout<<"请输入学号:

"<

cin>>p->number;

cout<<"请输入姓名:

"<

cin>>p->name;

cout<<"请输入性别:

"<

cin>>p->sex;

cout<<"请输入家庭住址:

"<

cin>>p->adds;

cout<<"请输入联系电话:

"<

cin>>p->phone;

cout<<"请输入qq:

"<

cin>>p->qq;

cout<<"请输入语文成绩:

"<

cin>>p->chinese;

if(p->chinese>100||p->chinese<0)

{

cout<<"成绩输入不符合规定,请重新输入:

"<

cin>>p->chinese;

}

cout<<"请输入数学成绩:

"<

cin>>p->math;

if(p->math>100||p->math<0)

{

cout<<"成绩输入不符合规定,请重新输入:

"<

cin>>p->math;

}

cout<<"请输入英语成绩:

"<

cin>>p->english;

if(p->english>100||p->english<0)

{

cout<<"成绩输入不符合规定,请重新输入:

"<

cin>>p->english;

}

cout<<"请输入同学互评分:

"<

cin>>p->txhp;

if(p->txhp>100||p->txhp<0)

{

cout<<"成绩输入不符合规定,请重新输入:

"<

cin>>p->txhp;

}

cout<<"请输入品德成绩:

"<

cin>>p->pinde;

if(p->pinde>100||p->pinde<0)

{

cout<<"成绩输入不符合规定,请重新输入:

"<

cin>>p->pinde;

}

cout<<"请输入任课教师评分:

"<

cin>>p->teacher;

if(p->teacher>100||p->teacher<0)

{

cout<<"成绩输入不符合规定,请重新输入:

"<

cin>>p->teacher;

}

p->ave=(p->chinese+p->math+p->english)/3.0;

p->zc=(p->ave*0.6+p->txhp*0.1+p->pinde*0.2+p->teacher*0.1);

cout<

cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<

cout<<"你刚输入的信息为:

"<

cout<<"\t\t学号:

"<number<

cout<<"\t\t姓名:

"<name<

cout<<"\t\t性别:

"<sex<

cout<<"\t\t家庭住址:

"<adds<

cout<<"\t\t联系电话:

"<phone<

cout<<"\t\tQQ号:

"<qq<

cout<<"\t\t语文成绩:

"<chinese<

cout<<"\t\t数学成绩:

"<math<

cout<<"\t\t英语成绩:

"<english<

cout<<"\t\t品德成绩:

"<pinde<

cout<<"\t\t教师评分:

"<teacher<

cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<

return;

}

//学生成绩录入函数

structstudent*input()

{

structstudent*head=NULL,*p1,*p2;//输入p1,p2链表最后节点

charch='y';

len=1;

p2=p1=(structstudent*)malloc(sizeof(structstudent));

cout<<"请输入第"<

"<

sinput(p1);

cout<

cout<<"按n退出或按任意键继续"<

cin>>ch;

while

(1)

{

if(len==1)//作为头结点

head=p1;

else

p2->next=p1;

p2=p1;

if(ch=='N'||ch=='n')

break;

p1=(structstudent*)malloc(sizeof(structstudent));

system("cls");

len++;

cout<<"请输入第"<

"<

sinput(p1);

cout<

cout<<"按n退出或按任意键继续"<

cin>>ch;

}

p2->next=NULL;

paixu_num(head);

cout<<"输入学生信息完成!

请按任意键返回主菜单!

"<

getchar();

returnhead;

}

//学号排序

voidpaixu_num(structstudent*head)

{

structstudentt,*r,*p,*q;//t交换p、q,r头结点

r=head;

if(r==NULL)

{

cout<<"学生信息不存在,请先输入学生信息!

"<

return;

}

while(r)

{

p=r;

q=r->next;

while(q)

{

if(strcmp(q->number,p->number)<0)//q

{

strcpy(t.number,q->number);

strcpy(t.name,q->name);

strcpy(t.sex,q->sex);

strcpy(t.adds,q->adds);

strcpy(t.phone,q->phone);

strcpy(t.qq,q->qq);

t.chinese=q->chinese;

t.math=q->math;

t.english=q->english;

t.txhp=q->txhp;

t.pinde=q->pinde;

t.teacher=q->teacher;

strcpy(q->number,p->number);

strcpy(q->name,p->name);

strcpy(q->sex,p->sex);

strcpy(q->adds,p->adds);

strcpy(q->phone,p->phone);

strcpy(q->qq,p->qq);

q->chinese=p->chinese;

q->math=p->math;

q->english=p->english;

q->txhp=p->txhp;

q->pinde=p->pinde;

q->teacher=p->teacher;

strcpy(p->number,t.number);

strcpy(p->name,t.name);

strcpy(p->sex,t.sex);

strcpy(p->adds,t.adds);

strcpy(p->phone,t.phone);

strcpy(p->qq,t.qq);

p->chinese=t.chinese;

p->math=t.math;

p->english=t.english;

p->txhp=t.txhp;

p->pinde=t.pinde;

p->teacher=t.teacher;

}

q=q->next;

}

r=r->next;

}

}

//插入函数

structstudent*insert(){

structstudent*p,*p1,*head;

head=Read();

p1=head;

p=(structstudent*)malloc(sizeof(structstudent));

charnum[14],ch;

cout<<"请输入你要插入的前一个学生的学号:

"<

cin>>num;

while(p1){

if(!

strcmp(p1->number,num)){

sinput(p);

p->next=p1->next;

p1->next=p;

len++;

}

else

p1=p1->next;

cout<<"按n退出或按任意键继续"<

cin>>ch;

if(ch=='N'||ch=='n')

break;

}

cout<<"学生信息插入成功!

请按任意键返回!

"<

getchar();

returnhead;

}

//修改学生信息

structstudent*alter()

{

chartemp[13];

structstudent*p,*head;

head=Read();

p=head;

cout<<"请输入要修改学生的学号:

";

cin>>temp;

while(p)

{

if(!

strcmp(p->number,temp))

{

sinput(p);

}

p=p->next;

}

cout<

cout<<"学生信息修改成功!

请按任意键返回!

"<

cout<

system("pause");

returnhead;

}

//删除学生信息

structstudent*del()

{

chartemp[13];

intm=0;

structstudent*p1,*p,*head;//p1删除

head=Read();

p1=p=head;

cout<<"请输入你要删除学生的学号:

"<

cin>>temp;

while(p){

if(strcmp(p1->number,temp)==0)

{

if(p1==head)//删除的头结点

head=p1->next;

else

p->next=p1->next;

len--;

m=1;

cout<<"学生信息删除成功!

请按任意键返回主菜单......."<

getchar();

returnhead;

}

else

p=p->next;

}

if(!

m)

cout<<"查找不到这个信息!

"<

returnhead;

}

voidfind_num(structstudent*head)//按学号查找

{

structstudent*p=head;

chartemp[9];

intm=0;

cout<<"请输入要查找的学生的学号"<

cin>>temp;

while(p!

=NULL)

{

if(strcmp(p->number,temp)==0)

{

cout<<"该学生的具体信息为:

"<

cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<

cout<<"\t\t学号:

"<number<

cout<<"\t\t姓名:

"<name<

cout<<"\t\t性别:

"<sex<

cout<<"\t\t家庭住址:

"<adds<

cout<<"\t\t联系电话:

"<phone<

cout<<"\t\tQQ号:

"<qq<

cout<<"\t\t语文成绩:

"<chinese<

cout<<"\t\t数学成绩"<math<

cout<<"\t\t英语成绩"<english<

cout<<"\t\t平均成绩"<ave<

cout<<"\t\t品德成绩"<pinde<

cout<<"\t\t老师评分"<teacher<

cout<<"\t\t综合成绩"<zc<

score_paixu(head);

cout<<"\t\t考试名次"<ksmc<

cout<<"\t\t综测名次"<zcmc<

cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<

m=1;

}

p=p->next;//继续向下寻找

}

if(!

m)

cout<<"查找不到这个学号的信息!

"<

cout<<"按任意键返回主菜单……"<

getchar();

return;

}

voidfind_name(structstudent*head)//按姓名查找

{

structstudent*p=head;

chartemp[9];

intm=0;

cout<<"请输入要查找的学生的姓名"<

cin>>temp;

while(p)

{

if(strcmp(p->name,temp)==0)

{

cout<<"该学生的具体信息为:

"<

cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<

cout<<"学号:

"<number<

cout<<"\t\t姓名:

"<name<

cout<<"\t\t性别:

"<sex<

cout<<"\t\t家庭住址:

"<adds<

cout<<"\t\t联系电话:

"<phone<

cout<<"\t\tQQ号:

"<qq<

cout<<"\t\t语文成绩:

"<chinese<

cout<<"\t\t数学成绩"<math<

cout<<"\t\t英语成绩"<english<

cout<<"\t\t平均成绩"<ave<

cout<<"\t\t品德成绩"<pinde<

cout<<"\t\t老师评分"<teacher<

cout<<"\t\t综合成绩"<zc<

score_paixu(head);

cout<<"\t\t考试名次"<ksmc<

cout<<"\t\t综测名次"<zcmc<

cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<

m=1;

}

p=p->next;

}

if(!

m)

cout<<"查找不到这个学号的信息!

"<

cout<<"按任意键返回主菜单……"<

getchar();

return;

}

voidoutput()

{

structstudent*p,*head;

head=Read();

p=head;

inti=1;

while(p)

{

cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<

cout<<"\t\t学号:

"<number<

cout<<"\t\t姓名:

"<name<

cout<<"\t\t性别:

"<sex<

cout<<"\t\t家庭住址:

"<adds<

cout<<"\t\t联系电话:

"<phone<

cout<<"\t\tQQ号:

"<qq<

cout<<"\t\t语文成绩:

"<chinese<

cout<<"\t\t数学成绩:

"<math<

cout<<"\t\t英语成绩:

"<english<

cout<<"\t\t品德成绩:

"<pinde<

cout<<"\t\t老师评分:

"<teacher<

cout<<"\t\t平均成绩:

"<ave<

cout<<"\t\t综合成绩:

"<zc<

score_paixu(head);

cout<<"\t\t考试名次"<ksmc<

cout<<"\t\t综合测评名次"<zcmc<

p=p->next;

i++;

}

cout<<"☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆"<

cout<

cout<<"请按任意键返回主菜单……"<

getchar();

return;

}

voidmax_student(structstudent*head){

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 高等教育 > 艺术

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1