c语言程序设计 学生成绩管理系统.docx

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

c语言程序设计 学生成绩管理系统.docx

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

c语言程序设计 学生成绩管理系统.docx

c语言程序设计学生成绩管理系统

 

实验题目:

学生成绩管理系统

一、实验目的

1.熟悉c语言的编译连接和运行过程。

2.掌握c语言的数据类型,熟悉整型、实型、字符型变量的定义式及如给它们赋值。

3.掌握if语句及switch语句的运用法及嵌套应用法。

4.掌握实现循环结构的三种语句while、do-while.、for的使用。

5.掌握函数的定义法和调用法。

6.能够采用模块化思想调试程序。

二.实验容

1.编写程序并进行调试运行。

2.输入学生资料,并保存于文件。

每个学生包含信息如:

姓名、学号、性别、物理成绩、数学成绩、英语成绩、计算机成绩。

3.对已存入的学生信息进行更新操作,包括更新学生信息信息、删除某个学生信息和修改学生信息。

4.通过按学生姓名的式查询学生信息。

5.输入某学生各门成绩进行统计。

6对学生物理成绩排序。

7.最后输出学生信息,供需要时打印。

二、需求分析

1.该程序可用于对学生的基本信息的存储、更新、查询、输出、统计、排序等操作。

2.其中更新功能包括:

添加信息、删除信息、修改信息、可根据需要添加一个或多个学生信息,也可对个别学生信息进行适当的删除或修改。

以便随时更新学生信息。

3.程序中设计的查询功能可根据需要从若干数据中查询某信息,

四、概要设计

1、案设计

对系统进行分析,给出结构图

分析:

系统要现多的功能,因此遵循结构化程序设计思想来进行本系统的设计—自顶向下、逐步细化,将系统设计任务分解出多子功能模块进行设计

结构图如下:

 

五功能模块的说明

1输入初始学生信息:

其中包括学生姓名,学号,性别,物理数学英语计算机成绩等相关信息;可用函数cin(stu*p1)来实现此操作。

2查询模块:

可用stu*lookdata(stu*p1)来实现。

找到就输出此学生全部信息包括学生物理数学英语计算机的成绩。

3插入模块:

可用insert()来实现。

其过学号的大小比较的,并且以此来排序。

4输出学生的信息及成绩:

通过学生的姓名来查看学生的语文数学英语计算机的有关成绩,同时也可以分别通过paverage()maverage()eaverage()comaverage()来输出物理数学英语计算机等成绩的平均分最高分最低分。

5退出系统:

可以用一个函数来实现,首先将信息保存在文件中,释放动态创建的存空间,再退出次程序。

流程图如下

六.调试情况及运行结果

1、

对自己设计进行评价,指出合理和不足之处,提出改进的案。

此次实践课编写的是一个应用程序,相对于以前我们见到的程序,它要大得多,于是就按课本上的例子编了超市管理系统,先把界面弄好然后再添加各模块,而且各模块也出现了不少问题,在同学们和老师的帮助下,我很有耐心的一次又一次的进行修改,最后运行的结果基本上达到了预期的目的。

可结果还不是太理想。

由于时间很短,在选题报告中设想到的好多功能都没有实现。

已有的那些功能虽已能基本上满足管理者和消费者的需要,但如果还有更多的功能程序就会更加完美。

如:

进入系统时没有设制密码,保护性不够强;在输入商品号时没有出错提示,如果商品号输入负值

2、在设计过程中的感受。

本次C语言的实习课让我对C语言的学习又有了更深入的了解,也让我更深刻地领悟到了“实践出真理”这个道理,在上机实践过程中学到的知识远远超过了在课堂上十几学到的,学校组织的这次实习让我们这些实践知识匮乏的大学生增添了多社会经验,为我们将来走上工作岗位其了不小的铺垫作用。

本次实习中遇到了很多以前没有遇到过的问题,也曾想过要放弃,但看到那些同学都在那认真的写程序,给了我继续的信心。

在同学的帮助下,我顺利的结束了本次实习,让我知道原来凭借自己努力取得的成功会让自己这么欣慰,也让我知道了友谊和团结的重要性。

七.参考文献

《C语言程序设计》曙燕锰科学出版社

八。

附录:

#include

#include

#include

#include

#include

#include

#defineMAX10

intsum=10;

typedefstructstudent/*定义结构体*/

{

charname[MAX];/*姓名*/

intnum;/*学号*/

charsex[MAX];/*性别*/

floatphysic;/*语文*/

floatmathematic;/*数学*/

floatenglish;/*英语*/

floatcomputer;/*计算机*/

structstudent*next;/*结构体指针*/

}stu;

stu*head;

 

/*读取信息*/

intread_message()

{FILE*fp;

stu*p;

inti=0;

if((fp=fopen("student_manage.txt","rb"))==NULL)

{printf("\n\n****暂时还没有任信息,输入密码进入主菜单选择基本信息录入!

****\n");

return0;

}

while(feof(fp)!

=1)

{fread(head,sizeof(stu),1,fp);

if(p->num==0)break;

elsei++;

}

fclose(fp);

return(i);

}

/*显示或打印函数*/

voidprint()

{

printf("\t\t\tScoreManageSystem\n");/*成绩管理系统*/

printf("\t\t\t成绩管理系统\n");

printf("<1>EnterRecord:

输入数据\n");/*输入数据*/

printf("<2>Display:

显示或打印\n");/*显示*/

printf("<3>find:

查找数据\n");/*访问数据*/

printf("<4>Renew_message:

更新模块\n");/*更新模块*/

printf("<5>Save:

保存数据\n");

printf("<6>sort_physic:

成绩排名\n");/*物理成绩排名*/

printf("<7>Count:

数据统计\n");/*数据统计*/

printf("<8>PhysicAverage:

物理平均成绩\n");/*物理平均成绩*/

printf("<9>MathAverage:

数学平均成绩\n");/*数学平均成绩*/

printf("<10>EnglishAverage:

英语平均成绩\n");/*英语平均成绩*/

printf("<11>ComputerAverage:

计算机平均成绩\n");/*计算机平均成绩*/

printf("<12>Quit:

退出\t\n");/*退出*/

}

 

/*****输入相关数据函数*****/

voidcin(stu*p1)

{

printf("\nEntername:

\n");

scanf("%s",&p1->name);

printf("Enternum:

\n");

scanf("%d",&p1->num);

printf("Entersex:

\n");

scanf("%s",&p1->sex);

printf("Enterscore\n");

printf("Enterphysic:

\n");

scanf("%f",&p1->physic);

printf("Entermathematic:

\n");

scanf("%f",&p1->mathematic);

printf("Enterenglish:

\n");

scanf("%f",&p1->english);

printf("Entercomputer:

\n");

scanf("%f",&p1->computer);

}

/*****其他数据是否输入函数*****/

stu*cindata()

{stu*p1,*p2;

inti=1;

charch;

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

head=p1;

while(i)

{cin(p1);

printf("Doyouwanttocontinue?

Yesorno:

\n");

fflush(stdin);

ch=getchar();

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

{i=0;

p1->next=NULL;

}

else

{p2=p1;

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

p2->next=p1;

}

}

return(p1->next);

}

 

/*查看数据函数*/

stu*lookdata(stu*p1)

{

while(p1!

=NULL)

{

printf("Name:

%s\t",p1->name);

printf("Num:

%d\t",p1->num);

printf("Sex:

%s\t",p1->sex);

printf("\n");

printf("Physic:

%f\t",p1->physic);

printf("Math:

%f\t",p1->mathematic);

printf("English:

%f\t",p1->english);

printf("Computer:

%f\t",p1->computer);

printf("\n");

p1=p1->next;

}

returnp1;

}

 

/*通过比较学号来插入数据的函数*/

voidinsert()

{stu*p1,*p3,*p2;

p1=head;

p3=(stu*)malloc(sizeof(stu));

p3->next=NULL;

if(head==NULL)

{head=p3;return;}

cin(p3);

while(p1!

=NULL&&(p1->numnum))

{p2=p1;p1=p1->next;}

if(p2==head)

{p3->next=head;head=p3;return;}

p3->next=p1;

p2->next=p3;

}

 

/*通过姓名来查找的函数*/

voidfind(stu*p2)

{charname[20];

intb=0;

printf("Enterthenameofthesutdentyouwanttofind:

");

scanf("%s",name);

while(p2!

=NULL)

{

if(strcmp(name,p2->name)==0)

{printf("Thedatayouwanthasbefind");

printf("Name:

%s\t",p2->name);

printf("Num:

%d\t",p2->num);

printf("Sex:

%s\t",p2->sex);

printf("\n");

printf("Physic%f\t",p2->physic);

printf("Math%f\t",p2->mathematic);

printf("English%f\t",p2->english);

printf("Computer%f\t",p2->computer);

printf("\n");

b=1;

}

elseif(b==0)

printf("sorrynotfinddata!

");

p2=p2->next;

}

if(b==1)

{

print();

printf("Findone\n");

}

else

{

print();

printf("Notfind\n");

}

}

 

/*求各学生物理平均成绩*/

 

voidpaverage()

{stu*p1;

inti;

floatmax=0.0,min=200.0;

floatsum=0.0,aver=0;

p1=head;

if(p1==NULL)

printf("notdata!

");

else

{for(i=0;p1!

=NULL;p1=p1->next)

sum+=p1->physic;

aver=sum/i;

p1=head;

for(i=0;p1!

=NULL;i++,p1=p1->next)

{if(maxphysic)

max=p1->physic;}

p1=head;

for(i=0;p1!

=NULL;i++,p1=p1->next)

if(min>p1->physic)

min=p1->physic;

}

printf("PhysicAverage:

%f",aver);

printf("PhysicMax:

%f",max);

printf("PhysicMin:

%f",max);

}

 

/*求各学生数学平均分最高和最低分成绩的函数*/

voidmaverage()

{stu*p1;

inti;

floatmax=0.0,min=200.0;

floatsum=0.0,aver=0;

p1=head;

if(p1==NULL)

printf("notdata!

");

else

{

for(i=0;p1!

=NULL;i++,p1=p1->next)

sum+=p1->mathematic;

aver=sum/i;

p1=head;

for(i=0;p1!

=NULL;i++,p1=p1->next)

{if(maxmathematic)

max=p1->mathematic;

}

p1=head;

for(i=0;p1!

=NULL;i++,p1=p1->next)

if(min>p1->mathematic)

min=p1->mathematic;

}

printf("MathAverage:

%f",aver);

printf("MathMax:

%f",max);

printf("MathMin:

%f",min);

}

 

/*求各学生英语平均分最高和最低分成绩的函数*/

 

voideaverage()

{stu*p1;

inti;

floatmax=0.0,min=200.0;

floatsum=0.0,aver=0;

p1=head;

if(p1==NULL)

printf("notdata!

");

else

{

for(i=0;p1!

=NULL;i++,p1=p1->next)

sum+=p1->english;

aver=sum/i;

p1=head;

for(i=0;p1!

=NULL;i++,p1=p1->next)

{if(maxenglish)

max=p1->english;

}

p1=head;

for(i=0;p1!

=NULL;i++,p1=p1->next)

if(min>p1->english)

min=p1->english;

}

printf("EnglishAverage:

%f",aver);

printf("EnglishMax:

%f",max);

printf("EnglishMin:

%f",min);

}

 

/*求各学生计算机平均成绩最高和最低分*/

voidcomaverage()

{stu*p1;

inti;

floatmax=0.0,min=200.0;

floatsum=0.0,aver=0;

p1=head;

if(p1==NULL)

printf("notdata!

");

else

{

for(i=0;p1!

=NULL;i++,p1=p1->next)

sum+=p1->computer;

aver=sum/i;

p1=head;

for(i=0;p1!

=NULL;i++,p1=p1->next)

{if(maxcomputer)

max=p1->computer;

}

p1=head;

for(i=0;p1!

=NULL;i++,p1=p1->next)

if(min>p1->computer)

min=p1->computer;

}

printf("ComputerAverage:

%f",aver);

printf("ComputerMax:

%f",max);

printf("ComputerMin:

%f",min);

}

 

/*统计物理平均和总分*/

voidaver_sum_physic()

{stu*p1;

inti;

floatsum=0,aver;

p1=head;

if(p1=NULL)

printf("notdata!

");

else

{for(i=0;p1!

=NULL;i++,p1=p1->next)

sum+=p1->physic;}

aver=sum/i;

printf("PhysicAverage:

%f",aver);

printf("PhysicSum:

%f",sum);

}

 

/*统计数学平均和总分*/

voidaver_sum_mathematic()

{stu*p1;

inti;

floatsum=0,aver;

p1=head;

if(p1=NULL)

printf("notdata!

");

else

{for(i=0;p1!

=NULL;i++,p1=p1->next)

sum+=p1->mathematic;}

aver=sum/i;

printf("MathematicAverage:

%f",aver);

printf("MathematicSum:

%f",sum);

}

 

/*统计英语平均和总分*/

voidaver_sum_english()

{stu*p1;

inti;

floatsum=0,aver;

p1=head;

if(p1=NULL)

printf("notdata!

");

else

{for(i=0;p1!

=NULL;i++,p1=p1->next)

sum+=p1->english;}

aver=sum/i;

printf("EnglishAverage:

%f",aver);

printf("EnglishSum:

%f",sum);

}

 

/*统计计算机平均和总分*/

voidaver_sum_computer()

{stu*p1;

inti;

floatsum=0,aver;

p1=head;

if(p1=NULL)

printf("notdata!

");

else

{for(i=0;p1!

=NULL;i++,p1=p1->next)

sum+=p1->computer;}

aver=sum/i;

printf("ComputerAverage:

%f",aver);

printf("ComputerSum:

%f",sum);

}

 

/*统计模块*/

voidcount()

{intchoice;

do

{

printf("*******统计学生平均分和总分********\n");

printf("<1>:

物理平均和总分\n");

printf("<2>:

数学平均和总分\n");

printf("<3>:

英语平均和总分\n");

printf("<4>:

计算机平均和总分\n");

printf("<0>返回主菜单:

\n");

printf("请选择(0~4):

\n");

scanf("%d",&choice);

switch(choice)

{case1:

aver_sum_physic();break;

case2:

aver_sum_mathematic();break;

case3:

aver_sum_english();break;

case4:

aver_sum_computer();break;

case0:

break;

}

}while(choice!

=0);

}

 

/*物理成绩排序*/

 

/*库存排行*/

sort_physic()

{

inti=1,j=1;

floatmin;

stu*newh,*newp,*tp1,*tp2,*p;

newp=newh=NULL;

tp1=tp2=NULL;

p=head;

do

{

i++;

p=p->next;

}while(p->next);

while(head!

=NULL)

{

p=head;

tp1=tp2=p;

min=p->physic;

while(p->next!

=NULL)

{

if(p->next->physic

{

min=p->next->physic;

tp1=p;

tp2=p->next;

}

p=p->next;

}

if(newh==NULL)newp=newh=tp2;

else

{

newp->next=tp2;

newp=tp2;

}

if(tp2==head)head=tp2->next;

else

{

tp1->next=tp2->next;

tp2->next=NULL;

}

}

head=newh;

p=head;

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

{

if(p!

=NULL)

{

printf("\n物理成绩排行\n");

printf("----------------------------------------------------");

printf("\n排名姓名性别学号物理成绩\n");

prin

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

当前位置:首页 > 农林牧渔 > 林学

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

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