C语言课程设计学生成绩管理系统.docx

上传人:b****4 文档编号:5478901 上传时间:2023-05-08 格式:DOCX 页数:24 大小:310.77KB
下载 相关 举报
C语言课程设计学生成绩管理系统.docx_第1页
第1页 / 共24页
C语言课程设计学生成绩管理系统.docx_第2页
第2页 / 共24页
C语言课程设计学生成绩管理系统.docx_第3页
第3页 / 共24页
C语言课程设计学生成绩管理系统.docx_第4页
第4页 / 共24页
C语言课程设计学生成绩管理系统.docx_第5页
第5页 / 共24页
C语言课程设计学生成绩管理系统.docx_第6页
第6页 / 共24页
C语言课程设计学生成绩管理系统.docx_第7页
第7页 / 共24页
C语言课程设计学生成绩管理系统.docx_第8页
第8页 / 共24页
C语言课程设计学生成绩管理系统.docx_第9页
第9页 / 共24页
C语言课程设计学生成绩管理系统.docx_第10页
第10页 / 共24页
C语言课程设计学生成绩管理系统.docx_第11页
第11页 / 共24页
C语言课程设计学生成绩管理系统.docx_第12页
第12页 / 共24页
C语言课程设计学生成绩管理系统.docx_第13页
第13页 / 共24页
C语言课程设计学生成绩管理系统.docx_第14页
第14页 / 共24页
C语言课程设计学生成绩管理系统.docx_第15页
第15页 / 共24页
C语言课程设计学生成绩管理系统.docx_第16页
第16页 / 共24页
C语言课程设计学生成绩管理系统.docx_第17页
第17页 / 共24页
C语言课程设计学生成绩管理系统.docx_第18页
第18页 / 共24页
C语言课程设计学生成绩管理系统.docx_第19页
第19页 / 共24页
C语言课程设计学生成绩管理系统.docx_第20页
第20页 / 共24页
亲,该文档总共24页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

C语言课程设计学生成绩管理系统.docx

《C语言课程设计学生成绩管理系统.docx》由会员分享,可在线阅读,更多相关《C语言课程设计学生成绩管理系统.docx(24页珍藏版)》请在冰点文库上搜索。

C语言课程设计学生成绩管理系统.docx

C语言课程设计学生成绩管理系统

C课程设计报告

 

专业:

班级:

学号:

姓名:

指导老师:

日期:

 

一、设计任务与要求

1.设计内容:

按班级完成对学生成绩的录入,修改,能按班级统计学生的成绩;求学生的总分及平均分;并能根据学生的平均成绩进行排序,能查询学生成绩,不及格科目及学生名单;能按班级输出学生的成绩单。

设置学生的成绩信息:

学生学号、姓名、所选课程名称、显示学生的姓名、所选课程名称以及平时成绩、期末成绩和总评成绩信息。

能根据学生的姓名、学号、班级进行相应成绩的查询。

2.课程设计的要求:

根据C++课程所学的概念、理论和方法,按照C++程序设计的基本步骤,设计出一个适当规模的程序来实现设计课程内容中的全部功能;设计主控模块程序.对给出的程序源代码要给出各部分的详细注释.自己根据能力及需要添加相应功能模块,增强模拟系统功能。

包括系统的功能分析、系统的功能模块设计、程序流程图或结构框图、逻辑结构设计,数据库中的表、课程设计体会。

二、系统分析

1.要求分析:

1)能对学生各科成绩进行录入

2)能对学生的成绩进行增加、删除、修改

3)能对学生的姓名、学号、班级进行修改

4)能对学生的成绩按总成绩,姓名,学号进行查询

5)能输出学生的姓名、学号、班级、成绩

6)能进行成绩统计、分析、排序

7)能进行总分查询排名

4.系统功能模块

学生成绩查询系统有:

成绩录入、增加、删除、修改,数据查询,排序显示构成。

5.模块框架图

三、程序代码

#include

#include

#include

#include

#include

#include

usingnamespacestd;

structxueshengguanli

{stringname;

stringbanbie;

intnum;

floatClanguage;

xueshengguanli*next;

};

typedefxueshengguanli*xueshengGL;

xueshengGLInput(xueshengGLhead)

{charSEL='y';

intm=0;

xueshengGLp1,p2,top;

ofstreamout_stream;

out_stream.open("student.txt",ios:

:

app);//以追加数据信息打开文件

if(out_stream.fail())

{cout<<"打开文件失败.\n";

exit

(1);

}

while(SEL=='y'||SEL=='Y')

{p1=newxueshengguanli;

p1->next=NULL;

cout<<"\n请输入姓名:

";

cin>>p1->name;

cout<<"\n请输入学号:

";

cin>>p1->num;

cout<<"\n请输入班级:

";

cin>>p1->banbie;

cout<<"\n请输入C语言成绩:

";

cin>>p1->Clanguage;

if(m==0)

{head=p1;

p2=head;

m=1;

}

else

{p2->next=p1;

p2=p1;

}

cout<<"\n是否继续输入?

(y/n)\n";//判断是否继续输入

cin>>SEL;

}

top=head;

//写入文件

while(head!

=NULL)

{out_stream<name<<""<num<<"\t"<banbie<<"\t"<Clanguage;

head=head->next;

}

out_stream.close();//关闭文件

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

cout<<"输入完毕.\n";

returntop;//返回链表头结点地址

}

//从文件里读取数据

xueshengGLWenJian(xueshengGLtop)

{intn=0;

xueshengGLp,h;

ifstreamin_stream;

in_stream.open("student.txt");

if(in_stream.fail())

{cout<<"打开文件失败.\n";

return0;

}

while

(1)

{if(in_stream.eof())

break;

else

{p=newxueshengguanli;

p->next=NULL;

in_stream>>p->name>>p->num>>p->banbie>>p->Clanguage;

if(n==0)

{top=p;

h=top;

n=1;

}

else

{h->next=p;

h=p;

}

}

}

in_stream.close();

returntop;

}

voidxuanzhe(xueshengGLtop)

{inth;

while(h<1||h>2)

{cout<<"\n请输入你要修改的项:

";

cin>>h;

if(h==1)

{cout<<"\n请输入新的班级:

";

cin>>top->banbie;

break;

}

elseif(h==2)

{cout<<"\n请输入新的C语言成绩:

";

cin>>top->Clanguage;

break;

}

else

cout<<"\n输入错误!

请重输!

\n";

}

}

//修改

xueshengGLChange(xueshengGLtop)

{stringNAME;

intNUM,l=0;

charSEL='y';

xueshengGLq,head;

cout<<"\n请输入修改人的姓名:

";

cin>>NAME;

cout<<"\n请输入修改人的学号:

";

cin>>NUM;

top=WenJian(top);

q=top;

while(top!

=NULL)

{

if(top->name==NAME&&top->num==NUM)

{l=1;

while(SEL=='y'||SEL=='Y')

{cout<<"\n1:

班级2:

C语言成绩\n";

xuanzhe(top);

cout<<"\n这是修改后的学生信息:

\n";

cout<<"\n姓名"<<"\t"<<"学号"<<"\t"<<"班级"<<"\t"<<"C语言成绩\n";

cout<name<<"\t"<num<<"\t"<banbie<<"\t"<Clanguage<

cout<<"\n是否继续修改?

(y/n)\n";

cin>>SEL;

}

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

cout<<"输入完毕,任意键返回\n";

break;

}

else

top=top->next;

}

//修改后学生信息写入文件

if(l==1)

{head=q;

ofstreamout_stream;

out_stream.open("student.txt",ios:

:

trunc);//以覆盖文件原数据方式打开文件

if(out_stream.fail())

{cout<<"打开文件失败.\n";

exit

(1);

}

while(head!

=NULL)

{out_stream<name<<""<num<<"\t"<<"\t"<banbie<<"\t"<Clanguage;

head=head->next;

}

out_stream.close();

}

else

cout<<"\n对不起,没有你要修改的人.\n\n";

returnq;

}

//删除

xueshengGLDel(xueshengGLtop)

{stringNAME;

intNUM,l=0,n=0;

xueshengGLp,h,q,back,head;

cout<<"\n请输入修改人的姓名:

";

cin>>NAME;

cout<<"\n请输入修改人的学号:

";

cin>>NUM;

ofstreamout_stream;

ifstreamin_stream;

in_stream.open("student.txt");

if(in_stream.fail())

{cout<<"打开文件失败.\n";

cout<<"还没有学生信息\n\n";

return0;

}

while

(1)

{if(in_stream.eof())

break;

else

{p=newxueshengguanli;

p->next=NULL;

in_stream>>p->name>>p->num>>p->banbie>>p->Clanguage;

if(n==0)

{top=p;

h=top;

n=1;

}

else

{h->next=p;

h=p;

}

}

}

in_stream.close();

q=top;

while

(1)

{

if(NAME==top->name&&NUM==top->num&&top->next==NULL)

{l=2;

top=q->next;

out_stream.open("student.txt",ios:

:

trunc);//删除文件

break;

}

if(NAME==top->name&&NUM==top->num&&top->next!

=NULL)

{l=1;

top=q->next;

cout<<"\n删除成功.\n";

break;

}

if(q->next==NULL)

{printf("\n对不起,没有找到此人!

\n");

break;

}

back=q;

q=q->next;

if(NAME==q->name&&NUM==q->num)

{l=1;

back->next=q->next;

cout<<"\n删除成功.\n";

break;

}

}

//删除学生信息后重新写入文件

if(l==1)

{head=top;

out_stream.open("student.txt",ios:

:

trunc);

if(out_stream.fail())

{cout<<"打开文件失败.\n";

exit

(1);

}

while(head!

=NULL)

{out_stream<name<<""<num<<"\t"<banbie<<"\t"<Clanguage;

head=head->next;

}

out_stream.close();

}

elseif(l==2)

cout<<"\n删除成功.\n";

else

cout<<"\n找不到此人信息!

\n";

returntop;

}

//查询

xueshengGLLookUp(xueshengGLtop)

{stringXM;

intnumber,l=0;

cout<<"\n请输入你查询的姓名:

";

cin>>XM;

cout<<"\n请输入你查询的学号:

";

cin>>number;

top=WenJian(top);

while(top!

=NULL)

{

if(XM==top->name&&number==top->num)

{l=1;

cout<

cout<<"\n这是你要查询人的信息.\n";

cout<<"\n姓名"<<"\t"<<"学号"<<"\t"<<"班级"<<"\t"<<"综合成绩\n";

cout<name<<"\t"<num<<"\t"

<banbie<<"\t"<Clanguage<

break;

}

else

top=top->next;

}

if(l==1)

cout<<"\n谢谢你的查询.\n";

else

cout<<"\n对不起,没有你要查询人的信息.\n";

cout<

returntop;

}

xueshengGLsort(xueshengGLtop)

{stringname1,banbie1;

intnum1;

floatClanguage1;

intn=0,l=0;

xueshengGLp1,p2,p3,p,h,head;

ifstreamin_stream;

in_stream.open("student.txt");

if(in_stream.fail())

{cout<<"打开文件失败.\n";

cout<<"还没有学生信息保存\n\n";

return0;

}

while

(1)

{if(in_stream.eof())

break;

else

{p=newxueshengguanli;

p->next=NULL;

in_stream>>p->name>>p->num>>p->banbie>>p->Clanguage;

l=1;

if(n==0)

{top=p;

h=top;

n=1;

}

else

{h->next=p;

h=p;

}

}

}

in_stream.close();

for(p1=top;p1->next!

=NULL;p1=p1->next)

{l=1;

for(p2=p1->next;p2!

=NULL;p2=p2->next)

{

if(p1->ClanguageClanguage)

{name1=p1->name;

p1->name=p2->name;

p2->name=name1;

num1=p1->num;

p1->num=p2->num;

p2->num=num1;

banbie1=p1->banbie;

p1->banbie=p2->banbie;

p2->banbie=banbie1;

Clanguage1=p1->Clanguage;

p1->Clanguage=p2->Clanguage;

p2->Clanguage=Clanguage1;

}

}

}

p3=top;

cout<<"\n以下是全部学生的综合成绩由高到低的排序:

\n";

cout<<"\n姓名"<<"\t"<<"学号"<<"\t"<<"班别"<<"\t"<<"C语言成绩\n";

while(p3!

=NULL)

{cout<name<<"\t"<num<<"\t"

<banbie<<"\t"<Clanguage<

p3=p3->next;

}

if(l==1)

{head=top;

ofstreamout_stream;

out_stream.open("student.txt",ios:

:

trunc);//以覆盖文件原数据方式打开文件

if(out_stream.fail())

{cout<<"打开文件失败.\n";

exit

(1);

}

while(head!

=NULL)

{out_stream<name<<""<num<<"\t"<<"\t"<banbie<<"\t"<Clanguage;

head=head->next;

}

out_stream.close();

}

else

cout<<"\n谢谢.\n";

cout<

returntop;

}

voiddisplay(xueshengGLtop)

{intl=0,n=0;

xueshengGLp,h;

ifstreamin_stream;

in_stream.open("student.txt");

if(in_stream.fail())

{cout<<"打开文件失败.\n";

cout<<"还没有学生信息\n\n";

return;

}

while

(1)

{if(in_stream.eof())

break;

else

{p=newxueshengguanli;

p->next=NULL;

in_stream>>p->name>>p->num>>p->banbie>>p->Clanguage;

l=1;

if(n==0)

{top=p;

h=top;

n=1;

}

else

{h->next=p;

h=p;

}

}

}

in_stream.close();

if(l==1)

{cout<<"\n以下是全部学生信息:

\n";

cout<<"\n姓名"<<"\t"<<"学号"<<"\t"<<"班别"<<"\t"<<"C语言成绩\n";

while(top!

=NULL)

{cout<name<<"\t"<num<<"\t"

<banbie<<"\t"<Clanguage<

top=top->next;

}

cout<

}

return;

}

intmain()

{xueshengGLhead;

intsel;

while

(1)

{cout<<"\t\t-------------------------------\n"

<<"\t\t欢迎使用学生信息管理系统\n"

<<"\t\t1输入学生信息\n"

<<"\t\t2修改学生信息\n"

<<"\t\t3删除学生信息\n"

<<"\t\t4查找学生信息\n"

<<"\t\t5学生综合成绩排序信息\n"

<<"\t\t6显示学生信息\n"

<<"\t\t0返回\n"

<<"\t\t-------------------------------\n\n\n";

cout<<"请你选择操作类型:

";

cin>>sel;

cout<<"\n";

switch(sel)

{case1:

head=Input(head);

break;

case2:

head=Change(head);

break;

case3:

head=Del(head);

break;

case4:

head=LookUp(head);

break;

case5:

head=sort(head);

break;

case6:

display(head);

break;

case0:

{cout<<"谢谢使用再见\n\n";

exit(0);

}

default:

cout<<"输入有错误请重新输入!

\n\n";

}

}

return0;

}

四、程序相关的截图

每一步的过程截图如下,读者可以将程序的代码输入进去进行相关的操作,也可以得到相应的结果!

五、心得体会

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

当前位置:首页 > 党团工作 > 入党转正申请

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2