c++大作业学生信息管理系统源代码.docx

上传人:b****8 文档编号:11352020 上传时间:2023-02-28 格式:DOCX 页数:26 大小:17.75KB
下载 相关 举报
c++大作业学生信息管理系统源代码.docx_第1页
第1页 / 共26页
c++大作业学生信息管理系统源代码.docx_第2页
第2页 / 共26页
c++大作业学生信息管理系统源代码.docx_第3页
第3页 / 共26页
c++大作业学生信息管理系统源代码.docx_第4页
第4页 / 共26页
c++大作业学生信息管理系统源代码.docx_第5页
第5页 / 共26页
点击查看更多>>
下载资源
资源描述

c++大作业学生信息管理系统源代码.docx

《c++大作业学生信息管理系统源代码.docx》由会员分享,可在线阅读,更多相关《c++大作业学生信息管理系统源代码.docx(26页珍藏版)》请在冰豆网上搜索。

c++大作业学生信息管理系统源代码.docx

c++大作业学生信息管理系统源代码

学生信息管理系统源代码:

structstudent

{

charnum[30];intmaths;

charname[30];intchinese;

charclas[30];intenglish;

inttotal;floataverage;

student*next;

};

//◆1

(1)

voidcreatelist(student*&head)//学生成绩文件导入功能(用链表储存)

{

chart[80],num0[30],name0[30],clas0[30];

intchinese0,maths0,english0;

student*s,*p;

if(!

instuf){cerr<<"filecouldnotbeopen."<

while(instuf>>num0>>name0>>clas0>>chinese0>>maths0>>english0)

{

s=newstudent;

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;

elsep->next=s;

p=s;

}

p->next=NULL;

}

//◆1

(2)

voidshowlist(student*head)//学生成绩信息显示功能(遍历链表)

{

intn=1;

cout<<"学号姓名班级语文数学英语总分均分序号";

while(head)

{

cout<num<<""<name<<'\t'<clas<<'\t'<<""<chinese<<'\t'

<maths<<'\t'<english<<'\t'<total<<'\t'<average<<'\t'<<""<

n=n+1;

head=head->next;

}

}

//◆2

voidcharu(student*head)//学生成绩信息插入功能(链表尾部插入学生成绩信息)

{

student*s,*p,*q;

intn,i;

cout<<"请输入需要【插入】的学生成绩信息的数量:

";

cin>>n;

cout<<"请输入需插入的学生成绩信息(每人一行):

"<

cout<<"学号姓名班级语文数学英语"<

p=head;

while(p)

{

q=p;

p=p->next;

}

for(i=1;i<=n;i++)

{

s=newstudent;

cin>>s->num>>s->name>>s->clas>>s->chinese>>s->maths>>s->english;

s->total=s->chinese+s->maths+s->english;s->average=float(s->total)/3;

q->next=s;

q=s;

}

q->next=NULL;

}

//◆3

voidshanchu(student*&head)//学生成绩信息删除功能

{

student*p,*q;

chara[30];

intn,i,b=1;

cout<<"请输入需【删除】的学生成绩信息的数量:

";

cin>>n;

cout<<"请输入需要删除的学生的学号或姓名:

"<

for(i=1;i<=n;i++)

{

cin>>a;

if((strcmp(head->num,a)==0)||(strcmp(head->name,a)==0))

{

b=0;

p=head;

head=head->next;

deletep;

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;

deleteq;

q=NULL;

}

}

}

if(b==1)cout<<"无此学号或姓名的成绩记录!

"<

}

//◆4

voidchange(student*head)//学生成绩信息的修改功能(修改指定学生信息)

{

chara[30];

intb=1;

cout<<"请输入您要【修改】的学生的学号或姓名:

";

cin>>a;

while(head)

{

if((strcmp(head->num,a)==0)||(strcmp(head->name,a)==0))

{

cout<<""<

b=0;

cout<<"此学生原来的学生成绩信息是:

"<

cout<<"学号姓名班级语文数学英语"<

cout<num<<""<name<<'\t'<clas<<'\t'<<""

<chinese<<'\t'<maths<<'\t'<english<

cout<<"请输入修改后的学生成绩信息:

"<

cout<<"学号姓名班级语文数学英语"<

cin>>head->num>>head->name>>head->clas>>head->chinese>>head->maths>>head->english;

head->total=head->chinese+head->maths+head->english;head->average=float(head->total)/3;

}

head=head->next;

}

if(b==1)cout<<"无此学号或姓名的成绩记录!

"<

}

//◆5

(1)

voidgeren(student*head)//查询个人成绩功能

{

chara[30];

intb=1;

cout<<"请输入您要【查询】的学生的学号或姓名:

";

cin>>a;

cout<<"此学生的学生成绩信息是:

"<

cout<<"学号姓名班级语文数学英语总分均分"<

while(head)

{

if((strcmp(head->num,a)==0)||(strcmp(head->name,a)==0))

{

b=0;

cout<num<<""<name<<'\t'<clas<<'\t'<<""<chinese<<'\t'

<maths<<'\t'<english<<'\t'<total<<'\t'<average<

}

head=head->next;

}

if(b==1)cout<<"无此学号或姓名的成绩记录!

"<

}

//◆5

(2)

voidchabanji(student*head)//查询班级成绩功能

{

chara[30];

intb=1;

cout<<"请输入您要查询成绩的【班级】的名称:

";

cin>>a;

cout<<"此班级的学生成绩信息是:

"<

cout<<"学号姓名班级语文数学英语总分均分"<

while(head)

{

if(strcmp(head->clas,a)==0)

{

b=0;

cout<num<<""<name<<'\t'<clas<<'\t'<<""<chinese<<'\t'

<maths<<'\t'<english<<'\t'<total<<'\t'<average<

}

head=head->next;

}

if(b==1)cout<<"无此班级的成绩记录!

"<

}

//◆5(3)

voidchayuwen(student*head)//查询语文成绩功能

{

inth,l,b=1;

cout<<"请输入您要查询的【语文】成绩的分数段:

"<

cout<<"起始分终止分"<

cin>>l;cin>>h;

cout<<"此分数段的学生语文成绩信息是:

"<

cout<<"学号姓名班级语文数学英语总分均分"<

while(head)

{

if((head->chinese>=l)&&(head->chinese<=h))

{

b=0;

cout<num<<""<name<<'\t'<clas<<'\t'<<""<chinese<<'\t'

<maths<<'\t'<english<<'\t'<total<<'\t'<average<

}

head=head->next;

}

if(b==1)cout<<"无此分数段的语文成绩记录!

"<

}

//◆5(4)

voidchashuxue(student*head)//查询数学成绩功能

{

inth,l,b=1;

cout<<"请输入您要查询的【数学】成绩的分数段:

"<

cout<<"起始分终止分"<

cin>>l;cin>>h;

cout<<"此分数段的学生数学成绩信息是:

"<

cout<<"学号姓名班级语文数学英语总分均分"<

while(head)

{

if((head->maths>=l)&&(head->maths<=h))

{

b=0;

cout<num<<""<name<<'\t'<clas<<'\t'<<""<chinese<<'\t'

<maths<<'\t'<english<<'\t'<total<<'\t'<average<

}

head=head->next;

}

if(b==1)cout<<"无此分数段的数学成绩记录!

"<

}

//◆5(5)

voidchayingyu(student*head)//查询英语成绩功能

{

inth,l,b=1;

cout<<"请输入您要查询的【英语】成绩的分数段:

"<

cout<<"起始分终止分"<

cin>>l;cin>>h;

cout<<"此分数段的学生英语成绩信息是:

"<

cout<<"学号姓名班级语文数学英语总分均分"<

while(head)

{

if((head->english>=l)&&(head->english<=h))

{

b=0;

cout<num<<""<name<<'\t'<clas<<'\t'<<""<chinese<<'\t'

<maths<<'\t'<english<<'\t'<total<<'\t'<average<

}

head=head->next;

}

if(b==1)cout<<"无此分数段的英语成绩记录!

"<

}

//◆5(6)

voidchazongfen(student*head)//查询总分成绩功能

{

inth,l,b=1;

cout<<"请输入您要查询的【总分】成绩的分数段:

"<

cout<<"起始分终止分"<

cin>>l;cin>>h;

cout<<"此分数段的学生总分成绩信息是:

"<

cout<<"学号姓名班级语文数学英语总分均分"<

while(head)

{

if((head->total>=l)&&(head->total<=h))

{

b=0;

cout<num<<""<name<<'\t'<clas<<'\t'<<""<chinese<<'\t'

<maths<<'\t'<english<<'\t'<total<<'\t'<average<

}

head=head->next;

}

if(b==1)cout<<"无此分数段的总分成绩记录!

"<

}

//◆6

(1)

voidyuwen(student*head)//按语文成绩从高到低排序功能

{

student*p,*q;

chara[30];

intb;

floatc;

p=head;

while(p)

{

q=p->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=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)

voidshuxue(student*head)//按数学成绩从高到低排序功能

{

student*p,*q;

chara[30];

intb;

floatc;

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=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)

voidyingyu(student*head)//按英语成绩从高到低排序功能

{

student*p,*q;

chara[30];

intb;

floatc;

p=head;

while(p)

{

q=p->next;

while(q)

{

if(p->englishenglish)

{

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->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(4)

voidzongfen(student*head)//按总分成绩从高到低排序功能

{

student*p,*q;

chara[30];

intb;

floatc;

p=head;

while(p)

{

q=p->next;

while(q)

{

if(p->totaltotal)

{

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->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;

}

}

//◆7

voidxuehao(student*head)//按学号从小到大排序功能

{

student*p,*q;

chara[30];

intb;

floatc;

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->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;

}

}

//◆8

voidxingming(student*head)//按姓名首字母排序功能

{

student*p,*q;

chara[30];

intb;

floatc;

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