c语言课程设计报告+学生成绩信息管理系统+源代码.docx

上传人:b****7 文档编号:9355114 上传时间:2023-02-04 格式:DOCX 页数:19 大小:59.57KB
下载 相关 举报
c语言课程设计报告+学生成绩信息管理系统+源代码.docx_第1页
第1页 / 共19页
c语言课程设计报告+学生成绩信息管理系统+源代码.docx_第2页
第2页 / 共19页
c语言课程设计报告+学生成绩信息管理系统+源代码.docx_第3页
第3页 / 共19页
c语言课程设计报告+学生成绩信息管理系统+源代码.docx_第4页
第4页 / 共19页
c语言课程设计报告+学生成绩信息管理系统+源代码.docx_第5页
第5页 / 共19页
点击查看更多>>
下载资源
资源描述

c语言课程设计报告+学生成绩信息管理系统+源代码.docx

《c语言课程设计报告+学生成绩信息管理系统+源代码.docx》由会员分享,可在线阅读,更多相关《c语言课程设计报告+学生成绩信息管理系统+源代码.docx(19页珍藏版)》请在冰豆网上搜索。

c语言课程设计报告+学生成绩信息管理系统+源代码.docx

c语言课程设计报告+学生成绩信息管理系统+源代码

实验报告

一、问题述及其需求分析

(一)问题述

学生信息管理系统是对学生信息的基本管理,其中包括以下及模块:

(1)增加一个学生的信息(需输入要增加学生的所有信息);

(2)统计本班学生总人数及男女生人数。

(3)分别按照学号查找学生的信息;若找到则输出该学生全部信息,否则输出查找不到的提示信息。

(4)按学号对所有学生信息排序,并输出结果;

(5)删除一个学生的信息(需指定要删除学生的学号);同时显示删除后的结果。

(二)功能需求分析

学生信息管理系统设计

学生信息包括:

学号,,性别,出生年月,

使之提供以下功能:

1、系统以菜单方式工作

2、建立链表并显示

3、插入新的学生信息

4、删除某学号的学生信息

5、查找某学号的学生信息

6、对学生信息排序

7、统计学生人数

8、输出学生信息

二总体设计

(一)模块

依据程序的数据结构,描述该程序的层次结构,如下图:

1、建立链表并显示

voidcreatelist(structstucode**r);

2、插入新的学生信息

voidinsert(structstucode**r);

3、删除某学号的学生信息

voiddel(structstucode**r);

4、查找某学号的学生信息

voidsearch1(structstucode*r);

5、对学生信息排序

voidsort(structstucode**r);

6、统计学生人数

voidsearch2(structstucode*r);

7、输出学生信息

voidout(structstucode*r);

(二)程序总体框架

模块层次结构,只确定了模块之间的关系和函数原型,不是程序的执行步骤。

程序总体框架是该程序的总体流程图。

改程序不是顺序连续地执行全部功能,而是在某一时刻有选择地执行一种或多种功能。

因此选用菜单方式是较佳的方案,程序总体框架如下图:

 

(三)运行环境(软,硬件环境)

硬件:

CPU,存,主板,硬盘,显卡,键盘,显示器等等。

软件:

WindowsXPtruboc应用软件。

(四)开发工具和编程语言

开发工具:

truboc

编程语言:

C语言

三、详细设计

(一)数据结构

依据给定学生信息和数据格式,数组用结构体实现,结构体层次结构:

structstud

{

学号整型longintnum;

字符串name[20];

性别字符串sex[2];

出生日期字符串birthday[12];

联系方式字符串tel[12];

};

头文件

#include

#include

#include

/*定义数据结构和链表*/

structstud

{

longnum;

charname[20];

charsex[2];

charbirthday[12];

chartel[12];

};

typedefstructstucode

{

structstudstudent;

structstucode*next;

}L;

(二)、算法说明

1、主函数的算法设计:

清屏、显示子菜单及运用选择操作(运用swith语句),调用各个子函数,最后退出程序,

主要代码:

while(flag)

{

system("cls");

menu();

choose=getchar();

switch(choose){}

2、各个子函数的算法设计

1、一些显示操作,输入相应的容即可

代码:

2、创建链表并显示学生信息

申请空间p=(L*)malloc(sizeof(L));

学生信息的输入及显示:

p->student.num=n;

strcpy(p->student.name,a);

p->next=NULL;

3、学生信息的删除

首先查询要删除的学生信息的学号,如果存在删除该学生,如果不存在给予相应的提示。

t=p->next;

p->next=p->next->next;

free(t);//释放空间

4、学生信息的排序

新建,然后按要求对学生信息进行排序

while(z->next&&z->next->student.num>=p->student.num)

z=z->next;

p->next=z->next;

z->next=p;

5、学生人数的统计:

6、学生信息的显示:

直接发调用函数即可。

四、运行结果

五、总结

1、调试分析

(1)刚编译完后有好多错误和警告,运行失败,然后经过修改错误警告慢慢减少,最终可以运行。

(2)该程序中可能还存在一些小问题,比如有的时候它会主动清屏,有的时候不会。

并且我在编译的过程中发现自己存在好多毛病,有粗心了等,不注意细节,其实自己也知道细节决定成败,以后我会注意。

2、设计总结

经过一周的课程设计,我学到了很多东西:

①巩固和加深了对数据结构的理解,提高综合运用本课程所学知识的能力。

②培养了我选用参考书,查阅手册及文献资料的能力。

培养独立思考,深入研究,分析问题、解决问题的能力。

③过实际编译系统的分析设计、编程调试,掌握应用软件的分析方法和工程设计方法。

④够按要求编写课程设计报告书,能正确阐述设计和实验结果,正确绘制系统和程序框图。

⑤通过课程设计,培养了我严肃认真的工作作风,逐步建立正确的生产观念、经济观念和全局观念。

课程设计是把我们所学的理论知识进行系统的总结并应用于实践的良好机会,有利于加强我们用知识理论来分析实际问题的能力,进而加强了我们对知识认识的实践度,巩固了我们的理论知识,深化了对知识的认识,并为走向社会打下一个良好的基础。

在这次课程设计中我遇到许多问题和麻烦,得到了老师的帮助和指导,才能够使得这次课程设计顺利的进行下去,另外,在程序调试过程中,也得到很多同学的帮助,给我及时指出错误,提出许多宝贵意见。

在此对老师和同学们表示感!

六、参考文献

书籍:

谭浩强《C程序设计》(第三版)清华大学

谭浩强《C程序设计题解与上机指导》(第三版)清华大学

王为青变红《C语言高级编程及实例剖析》人民邮电

建勋《C语言程序设计教程》清华大学

玲桂玮珍莲英《C语言程序设计教程习题解答与实验指导》人民邮电

 

源程序:

#include

#include

#include

structstud

{

longnum;

charname[20];

charsex[2];

charbirthday[12];

chartel[12];

};

typedefstructstucode

{

structstudstudent;

structstucode*next;

}L;

 

voidmenu();

voidcreatelist(structstucode**r);

voidout(structstucode*r);

voidsearch1(structstucode*r);

voidsearch2(structstucode*r);

voiddel(structstucode**r);

voidinsert(structstucode**r);

voidsort(structstucode**r);

voidmain()

{

charchoose;

intflag=1;

structstucode*r=NULL;

while(flag)

{

system("cls");

menu();

choose=getchar();

switch(choose)

{

case'1':

createlist(&r);

out(r);

printf("Testingfunction1\nPressanykeytocontinue\n");

getchar();

getchar();

break;

case'2':

search1(r);

printf("Testingfunction1\nPressanykeytocontinue\n");

getchar();

getchar();

break;

case'3':

search2(r);

printf("Testingfunction1\nPressanykeytocontinue\n");

getchar();

getchar();

break;

case'4':

del(&r);

out(r);

printf("Testingfunction1\nPressanykeytocontinue\n");

getchar();

getchar();

break;

case'5':

insert(&r);

out(r);

printf("Testingfunction1\nPressanykeytocontinue\n");

getchar();

getchar();

break;

case'6':

sort(&r);

out(r);

printf("Testingfunction1\nPressanykeytocontinue\n");

getchar();

getchar();

break;

case'7':

out(r);

printf("Testingfunction7\nPressanykeytocontinue\n");

getchar();

getchar();

break;

case'0':

flag=0;

printf("Theend.\n");

getchar();

getchar();

break;

default:

printf("\nWrongSelection!

(选择错误,请重选!

)\n");getchar();

getchar();

}

}

}

voidcreatelist(structstucode**r)

{

structstucode*p,*t;

longn;

chara[20];

chars[4];

charb[12];

charm[12];

if(*r)*r=NULL;

printf("\n请输入:

\n学号(请按学号升序排列)性别出生日期(若要结束请输入五个为零)\n");

scanf("%ld%s%s%s%s",&n,a,s,b,m);

if(n==0)return;

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

p->student.num=n;

strcpy(p->student.name,a);

strcpy(p->student.sex,s);

strcpy(p->student.birthday,b);

strcpy(p->student.tel,m);

p->next=NULL;

*r=p;

scanf("%ld%s%s%s%s",&n,a,s,b,m);

while(n)

{

t=p;

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

p->student.num=n;

strcpy(p->student.name,a);

strcpy(p->student.sex,s);

strcpy(p->student.birthday,b);

strcpy(p->student.tel,m);

p->next=NULL;

t->next=p;

scanf("%ld%s%s%s%s",&n,a,s,b,m);

}

}

voidsearch1(structstucode*r)

{

longx;

if(!

r)

{

printf("没有学生信息可查询!

\n");

return;

}

printf("请输入要查询的学生信息的学生学号:

\n");

scanf("%ld",&x);

while(r&&r->student.num!

=x)

r=r->next;

if(r==NULL)

printf("Error!

Nosuchstudent!

\n");

else

printf("%ld%s%s%s%s\n",r->student.num,r->student.name,r->student.sex,r->student.birthday,r->student.tel);

}

voidsearch2(structstucode*r)

{

inta=0,b=0,c=0;

if(!

r)

{

printf("没有学生信息可统计!

\n");

return;

}

else{

while(r)

{a++;

if(strcmp(r->student.sex,"男")=='0'){b++;}

if(strcmp(r->student.sex,"女")==0){c++;}

r=r->next;}

}

printf("共有学生%d人,其中男生%d人,女生%d人",a,b,c);

}

voiddel(structstucode**r)

{

longk;

structstucode*p=*r,*t;

if(!

(*r))

{

printf("没有学生信息可删除!

\n");

return;

}

printf("请输入要删除的学生信息的学生学号:

\n");

scanf("%ld",&k);

if(p->student.num==k)

*r=(*r)->next,free(p);

else

{

while(p->next&&p->next->student.num!

=k)

p=p->next;

if(p->next==NULL)

printf("Error!

Nosuchstudent!

\n");

else

{

t=p->next;

p->next=p->next->next;

free(t);

}

}

}

voidinsert(structstucode**r)

{

longn;

chara[20];

chars[4];

charb[12];

charm[12];

L*p,*t,*k;

printf("\n请输入:

\n学号(请按学号升序排列)性别出生日期(若要结束请输入三个为零)\n");

scanf("%ld%s%s%s%s",&n,a,s,b,m);

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

p->student.num=n;

strcpy(p->student.name,a);

strcpy(p->student.sex,s);

strcpy(p->student.birthday,b);

strcpy(p->student.tel,m);

if(!

(*r))

{

*r=p;

(*r)->next=NULL;

return;

}

if(p->student.num<(*r)->student.num)

p->next=(*r),(*r)=p;

else

{

t=*r;

k=t;

while(t->next&&t->next->student.num<=p->student.num)

t=t->next;

p->next=t->next;

t->next=p;

*r=k;

}

}

voidsort(structstucode**r)

{

structstucode*t,*p,*q,*z;

if(!

r)

{

printf("没有学生信息可排序!

\n");

return;

}

if(!

(*r)||!

(*r)->next)

return;

t=*r;

p=t->next;

t->next=NULL;

while(p)

{

q=p->next;

if(p->student.num>t->student.num)

{

p->next=t;

t=p;

}

else

{

z=t;

while(z->next&&z->next->student.num>=p->student.num)

z=z->next;

p->next=z->next;

z->next=p;

}

 

p=q;

}

*r=t;

}

voidout(structstucode*r)

{

printf("\n\n");

if(!

r)

{

printf("没有学生信息可输出!

\n");

return;

}

while(r)

{

printf("%ld%s%s%s%s\n",r->student.num,r->student.name,r->student.sex,r->student.birthday,r->student.tel);

r=r->next;

}

printf("\n\n");

}

voidmenu()

{

printf("\n学生信息管理系统\n");

printf("\n菜单\n\n");

printf("\n1建立链表并显示\n");

printf("\n2查找某学号的学生信息\n");

printf("\n3查找某的学生信息\n");

printf("\n4删除某学号的学生信息\n");

printf("\n5插入新的学生信息\n");

printf("\n6按学号降序排列输出\n");

printf("\n7输出\n");

printf("\n0退出\n");

printf("\n请选择您要执行的选项:

\n");

}

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

当前位置:首页 > 高等教育 > 文学

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

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