目 录
一、前言…………………………………………………………………2
二、引言…………………………………………………………………2
2.1系统开发工具…………………………………………………… 2
2.2实习目的………………………………………………… 3
2.3实习基本内容与要求……………………………………………3
2.4实习时间安排…………………………………………………… 3
2.5实习地点………………………………………………………… 3
2.6实习内容……………………………………………………………………… 3
三、学生成绩管理系统分析……………………………………………4
3.1系统概况…………………………………………………………4
3.2需求分析…………………………………………………………4
3.3总体功能要求……………………………………………………5
3.3.1总体功能模块……………………………………………… 5
3.3.2各函数的功能和实现………………………………………… 6
3.3.3各部分流程图…………………………………………………………… 6
3.3.4性能要求………………………………………………………………… 8
四、详细设计……………………………………………………………8
4.1关键部分的代码、说明及运行结果图………………………………………8
1、全局定义部分………………………………………………………8
2、主程序部分…………………………………………………………8
3、输入信息部分………………………………………………………10
4、输出信息部分………………………………………………………12
5、排序部分………………………………………………13
6、插入信息部分………………………………………………14
7、删除部分………………………………………………15
4.2总程序………………………………………………………………16
五、实习心得体会………………………………………………………24
六、附录:参考文献……………………………………………………25
一、前言
随着科学技术的不断提高,计算机科学日渐成熟,其强大的功能已为人们深刻认识,它已进入人类社会的各个领域并发挥着越来越重要的作用。作为计算机应用的一部分,使用计算机对学生成绩信息进行管理,具有手工管理所无法比拟的优点。例如,检索迅速,查找方便,可靠性高,存储量大,保密性好,寿命长,成本低等。这些优点能极大地提高学生档案管理的效率,也是企业的科学化、正规化管理,与世界接轨的重要条件。因此,开发学生成绩管理系统很有必要。
学生成绩管理系统是为了适应现代化学校的管理,加快推进数字化校园的建设、充分利用校园网,利用网络、多媒体等计算机应用技术和手段,提高办公效率、改善质量的高效管理学校系统。
学生成绩管理系统是系科综合管理系统的重要组成部分,为学校学生层面的管理提供了一个有用的数字化学生成绩管理系统的工具,在学校学生管理中起着举足轻重的作用。
为了培养自己正确的程序设计思想,使平时学习的理论联系实际,培养自己严肃认真,实事求是的科学态度和勇于探索的创新精神,培养自己综合运用所学知识与实践经验,分析和解决相应领域的工程技术问题或进行软件项目开发的能力。学院依照课程教学大纲和课程设计大纲提出了本次课程设计的题目及要求。
要求掌握C程序的基本结构和C语言基本的数据结构,熟悉C程序的编辑、编译、调试和运行过程,了解程序设计的一般方法、结构化程序设计的思想,熟悉算法的描述工具—N—S流程图的使用及常用算法,能够熟练地阅读用C语言编写的程序,能够运用结构化程序设计编写C程序。
二、引言
2.1系统开发工具简介
WIN-TC是一个TC2 WINDOWS平台开发工具。该软件使用TC2为内核,提供WINDOWS平台的开发界面,因此也就支持WINDOWS平台下的功能,例如剪切、复制、粘贴和查找替换等。而且在功能上也有它的独特特色例如语法加亮、C内嵌汇编、自定义扩展库的支持等。并提供一组相关辅助工具令你在编程过程中更加游刃有余,如虎添翼。本软件用于编写C语言程序 。
2.2实习目的
进一步加深、巩固所学专业课程(《C语言程序设计》)的基本理论知识,理论联系实际,进一步培养自己综合分析问题和解决问题的能力。掌握运用C语言独立地编写、调试应用程序和进行其它相关设计的技能。
使学生在掌握C语言的基本语法的基础上,能够更好的理解和运用其解决实际问题。在实践实习操作中让学生对结构化程序设计有更进一步深刻的认识与了解,提高学生的实践操作能力。
2.3、实习基本内容与要求:
用链表实现简单的学籍管理
1、总体功能要求
(1)链表的建立:每个节点包括:学号、姓名、性别、语文、数学、英语、总分;
(2)节点的插入:按学号的顺序插入;
(3)删除链表中的节点:按学号或者姓名;
(4)链表的输出:按学号排序、按总分排序。
2、性能的要求:
(1)各个功能分别用函数实现;
(2)节点信息让用户通过键盘输入;
(3)总分通过计算获得;
(4)有简单的操作界面;
(5)尽可能考虑程序的容错性、可操作性。
3、写实习报告以及心得体会
2.4实习时间安排
20##年7月12日 在服务器上下载应用程序、实习报告模板,练习书本第11章的例题
20##年7月13日 在自己的机器上程序设计
20##年7月14日 程序设计
20##年7月15日 撰写实习报告及心得体会
20##年7月16日 交实习报告
2.5 实习地点:c1 2楼机房
2.6实习内容
对学生信息(包括姓名、学号、语文、数学、英语、平均分、总分)进行管理,包括学生成绩的信息输入、输出、查询、删除、排序、退出、保存.将学生的成绩信息进行记录,信息内容包含:(1)学生的学号(2)学生的姓名(3)学生的成绩。假设,现收集到了一个班学生的所有成绩信息,要求用C语言编写一个简单的成绩管理系统,可进行录入、查询、修改、排序和浏览等功能。学习相关开发工具和应用软件,熟悉系统建设过程。
三、学生成绩管理系统分析
3.1系统概况
本次实习是通过建立一个学生学籍管理系统来更好的认识和掌握C语言中链表这一重要的知识内容.本系统实现的功能如下:
1.创建学生学籍信息,每个学生学籍信息包括:学号、姓名、语文、数学、英语、平均分、总分;
2.插入信息:按照学号由小到大的循序插入信息;
3.查找信息:通过选择按照学号或者姓名来查找到该学生的信息;
4.删除信息:通过选择按照学号或者按照姓名删除某个学生学籍信息;
5.输出信息:通过选择按学号(由小到大)或者总分(由小到大)或者平均分(由小到大)来输出信息;
6.保存信息:对学生学籍系统中的信息以记事本的学生进行保存。
本系统的亮点是在运用模块来组建该学生学籍管理系统,也就是说各个功能以模块的实现,通过主函数来调用模块,实现管理功能,这样程序结构清晰,容易检查到错误所在模块,减少了调试的压力。其次,是运用结构体来组织数据,数据结构规范,通过指针的操作很容易实现简单的查找、删除、输出等操作。最后,容错性较好,比如输入成绩输入时按照我们百分制输入,必须输入1-100之间的数字,如果输入的不是1-100中的数据,在系统将显示信息错误信息,要求重新输入。
软件配备:TurboC2.0,Windows 2000/20003/xp等;
硬件配备:内存:512MB及以上;
外存:60GB及以上;
CPU: 奔4及以上;
3.2需求分析
1、用C语言实现系统;
2、对学生信息(包括学号、姓名、语文、数学、英语、平均分)进行管理,包括学生成绩的信息输入、输出、查询、删除、排序、统计、退出.
3、学生信息包括:其内容较多,为了简化讨论,要求设计的管理系统能够完成以下功能:
(1)、每一条记录包括一个学生的学号、姓名、3门课成绩
(2)、成绩信息录入功能:(成绩信息用文件保存,可以一次完成若干条记录的输入。)
(3)、成绩信息显示浏览功能:完成全部学生记录的显示。
(4)、查询功能:完成按姓名查找学生记录,并显示。
(5)、成绩信息的删除:按学号进行删除某学生的成绩.
(6)、排序功能:按学生平均成绩进行排序。
(7)、应提供一个界面来调用各个功能,调用界面和各个功能的操作界面应尽可能清晰美观!
3.3总体功能要求
3.3.1总体功能模块
学生成绩管理信息系统的主界面,包括六个内容:信息输入,信息输出,信息删除,信息的排序,信息的查找和信息的保存。
信息输入包括创建信息和信息添加:其中创建的学生信息包括学生的学号,姓名,性别以及语文,数学,英语三门课程的成绩。信息添加的内容也是创建的所有学籍信息。
信息删除是按照学生的学号进行删除。
信息的排序也可以分为三种方法进行:一是按照学号进行排序,二是根据学生语文、数学、英语三门课程的总分进行排序,三是根据学生语文、数学、英语三门课程的平均分进行排序。
信息的查找时按照学生的学号进行查找。
信息的保存是通过程序与文件的链接进行的,可以直接将学生成绩以记事本的形式保存到指定文件夹中。
总 体 功 能 模 块 图
3.3.2各函数的功能和实现
1、输入初始的学生信息:输入信息包括学生的姓名、学号以及学生的成绩等相关信息;可用函数void input(STUDENT *data, int *len)来实现此操作。
2、成绩输出模块:输出学生的信息以及成绩void output(STUDENT *data, int len):通过学生的姓名来查看学生的相关成绩,同时也可以分别通过caverage() 、maverage() 、eaverage() 和comaverage() 来输出成绩的平均分数、最高和最低分数。
3、成绩查询模块:可用void find(STUDENT *data, int len) 来实现。找到就输出此学生全部信息。
4、删除模块:用函数void delete_item(STUDENT *data, int *len)来实现
5、排序模块:用函数void sort(STUDENT *data, int len)来实现
6、统计功能能:用函数void stat(STUDENT *data, int len) 来实现
7、退出系统:可用一个函数exit()来实现,首先将信息保存到文件中,释放动态创建的内存空间,再退出此程序。
3.3.3各部分流程图
1.学生信息输入流程图 2.学生信息输出流程图
3.删除的流程图
4.插入信息的流程图
5.对信息的排序流程图
3.3.4性能要求
1、功能分别用函数实现;
2、信息让用户通过键盘输入;
3、通过计算获得;
4、简单的操作界面;
5、可能考虑程序的容错
四、详细设计
4.1关键部分的代码、说明及运行结果图
1、全局定义部分
#include<stdio.h>
#include <string.h>
#include<ctype.h>
#include <malloc.h>
#define NULL 0 /*令NULL为0,表示空地址*/
#define LEN sizeof(struct student) /*令LEN代表struct student类型数据的长度,sizeof是“求字节数运算符”*/
struct student /*定义结构体*/
{
long num; /*定义学生学号*/
char name[20]; /*定义姓名*/
char sex[10]; /*定义性别*/
int chinese; /*语文分数,假设为整数*/
int math; /*数学分数*/
int english; /*英语分数*/
int sum; /*三门总分*/
struct student *next;
};
int n; /*n为全局变量,定义为节点个数*/
/*创建链表,带回一个指向链表头的指针*/
struct student *creat(vonum)
{ struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN); /*开辟一个新单元*/
printf("\nInput student's number: (press 0 to exit) ");
2、主程序部分
main() /*主函数*/
{struct student *head,*stu;
long del_num;
int N;
a:
printf("The student information management system \n");
printf("\n ( LIST) \n");
printf(" 1.Create a new namelist\n");
printf(" 2.Print the namelist\n");
printf(" 3.Delete a record from the namelist\n");
printf(" 4.insert a record\n");
printf(" 5.sort the programme\n");
printf(" 0.exit the programme\n");
printf("please enter the number:");
scanf("%d",&N);
switch(N)
{case 0:exit(0);goto end;
case 1:
printf("input records:\n");
head=creat();
print(head);break;
case 2:
print(head);break;
case 3:
printf("\ninput the delete number :");
scanf("%1d",&del_num);
while(del_num!=0)
{head=del(head,del_num);
print(head);
printf("\ninput the deleted number:");
scanf("%1d",&del_num);
}break;
case 4:
printf("\ninput the insert record:");
stu=(struct student *)malloc(LEN);
printf("\nplease input number :");
scanf("%ld",&stu->num);
printf("please input name");
scanf ("%s",&stu->name);
printf("please choose sex(f or m):");
scanf("%s",&stu->sex);
printf("please input chinese score:");
scanf("%d",&stu->chinese);
printf("please input maths score:");
scanf("%d",&stu->maths);
printf("please input english score:");
scanf("%d",&stu->english);
while(stu->num!=0)
{head=insert(head,stu);
print(head);
printf("\ninput theinsert record:");
stu=(struct student*)malloc(LEN);
printf("\nplease input number:");
scanf("%ld",&stu->num);
printf ("please input name:");
scanf("%s",&stu->name);
printf("please choose sex(f or m):");
scanf("%s",&stu->sex);
printf("please input chinese score:");
scanf("%d",&stu->chinese);
printf("please input maths score:");
scanf ("%d",&stu->maths);
printf("please input english score:");
scanf("%d",&stu->english);break;
case 5:
head=sort(head);
print(head);break;
}goto a;
end:;
}
}
3、输入信息部分
/*输入数据*/
scanf("%ld",&p1->num);
if (p1->num!=0)
{
a:
printf("Input student's name: ");
scanf("%s",&p1->name);
b:
printf("Input student's sex(f or m): ");
scanf("%s",&p1->sex);
c:
printf("Input chinese score: ");
scanf("%d",&p1->chinese);
if(p1->chinese>100||p1->chinese<0) /*验证成绩是否在0——100之间*/
{printf("Please enter a number between 0 to 100!\n");
goto c;
}
d:
printf("Input math score: ");
scanf("%d",&p1->math);
if(p1->math>100||p1->math<0)
{printf("Please enter a number between 0 to 100!\n");
goto d;
}
e:
printf("Input english score: ");
scanf("%d",&p1->english);
if(p1->english>100||p1->english<0)
{printf("Please enter a number between 0 to 100!\n");
goto e;
}
}
head=NULL;
while(p1->num!=0)
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *) malloc(LEN);
printf("\nInput student's number (press 0 to exit): ");
scanf("%ld",&p1->num);
if (p1->num!=0)
{printf("Input student's name: ");
scanf("%s",&p1->name);
printf("Input student's sex(f or m): ");
scanf("%s",&p1->sex);
printf("Input Chinese score: ");
scanf("%d",&p1->chinese);
if(p1->chinese>100||p1->chinese<0)
{printf("Please enter a number between 0 to 100\n"); /*验证成绩是否在0——100之间*/
goto c;
}
printf("Input math score: ");
scanf("%d",&p1->math);
if(p1->math>100||p1->math<0)
{printf("Please enter a number between 0 to 100\n"); /*验证成绩是否在0——100之间*/
goto d;
}
printf("Input english score: ");
scanf("%d",&p1->english);
if(p1->english>100||p1->english<0)
{printf("Please enter a number between 0 to 100\n");
goto e;
}
}
}
p2->next=NULL;
return(head);
}
输入界面如下:
4、输出信息部分
/*输出链表*/
void print(struct student *head)
{
struct student *p;
printf("\n=============Student information=============\n");
printf("\nthe %d recrods are:\n",n);
printf("| NO. | Name | Sex |Chi |math|Eng | sum|\n");
printf("|----------|--------|-----|----|----|----|------|\n");
p=head;
if(p!=NULL)
do
{
p->sum=p->chinese+p->math+p->english;
/*求总分赋给totalscorescore*/
/*输出各项值*/
printf("|%10ld|%8s|%5s|%4d|%4d|%4d|%6d|\n",
p->num, p->name,p->sex,p->chinese,p->math,
p->english,p->sum);
p=p->next;/*将p原来指向的节点中next的值赋给p,使p指向第下一个节点*/
p->sum=NULL; /*将总分totalscorescore赋空地址*/
}while(p!=NULL);
else printf("\nNo records\n");
printf("===============END====================\n") ;
}
5、排序部分
struct student *sort(struct student *head) /*排序函数*/
{int i=0;
struct student *p,*q,*t,*h1;
h1=head->next;
head->next=NULL;
while(h1!=NULL)
{t=h1;
h1=h1->next;
p=head;
q=head;
while(t->total>p->total&&p!=NULL)
{q=p;
p=p->next;}
if(p==q)
{t->next=p;
head=t;}
else
{t->next=p;
q->next=t;}
}
p=head;
while(p!=NULL)
{i++;
p->order=i;
p=p->next;
}
printf("sort sucess!\n");
return(head);
}
如按总分排序,界面如下:
按学号排序,界面如下:
6、插入信息部分
/*插入结点函数*/
struct student *insert(struct student *head,struct student *stud) {struct student *p0,*p1,*p2;
p1=head;
p0=stud;
if(head==NULL)
{head=p0;
p0->next=NULL;}
else
{while((p0->num>p1->num)&&(p1->next!=NULL))
{p2=p1;p1=p1->next;}
if(p0->num<=p1->num)
{if(head==p1)
head=0;
else p2->next=p0;
p0->next=p1;}
else
{p1->next=p0;
p0->next=NULL;}
}
n=n+1;
p1->order=n;
return(head);
}
7、删除部分
/*删除节点*/
struct student *del(struct student *head,long num)/*参数为起始地址head和学号number*/
{
struct student *p1,*p2;
if(head==NULL){printf("\nlist null! \n");}
p1=head;
while (num!=p1->num&&p1->next!= NULL) /**p1指向的不是所要找的节点,并且后面还有节点*/
{
p2=p1;p1=p1->next; /**p1后移一个节点*/
}
if(num==p1->num)
{
if(p1==head)head=p1->next;/*若p1指向的是头节点,把第二个节点地址赋予head*/
else p2->next=p1->next; /*否则将下一节点地址赋给前一节点地址*/
printf("delete:%ld\n",num);
n=n-1;
}
else printf("%ld not been found!\n",num); /*找不到该节点*/
return(head);
}
界面如下:
删除后
4.2、总程序
#include<stdio.h>
#include <string.h>
#include<ctype.h>
#include <malloc.h>
#define NULL 0 /*令NULL为0,表示空地址*/
#define LEN sizeof(struct student) /*令LEN代表struct student类型数据的长度,sizeof是“求字节数运算符”*/
struct student /*定义结构体*/
{
long num; /*定义学生学号*/
char name[20]; /*定义姓名*/
char sex[10]; /*定义性别*/
int chinese; /*语文分数,假设为整数*/
int math; /*数学分数*/
int english; /*英语分数*/
int sum; /*三门总分*/
struct student *next;
};
int n; /*n为全局变量,定义为节点个数*/
/*创建链表,带回一个指向链表头的指针*/
struct student *creat(vonum)
{ struct student *head;
struct student *p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN); /*开辟一个新单元*/
printf("\nInput student's number: (press 0 to exit) "); /*输入数据*/
scanf("%ld",&p1->num);
if (p1->num!=0)
{
a:
printf("Input student's name: ");
scanf("%s",&p1->name);
b:
printf("Input student's sex(f or m): ");
scanf("%s",&p1->sex);
c:
printf("Input chinese score: ");
scanf("%d",&p1->chinese);
if(p1->chinese>100||p1->chinese<0) /*验证成绩是否在0——100之间*/
{printf("Please enter a number between 0 to 100!\n");
goto c;
}
d:
printf("Input math score: ");
scanf("%d",&p1->math);
if(p1->math>100||p1->math<0)
{printf("Please enter a number between 0 to 100!\n");
goto d;
}
e:
printf("Input english score: ");
scanf("%d",&p1->english);
if(p1->english>100||p1->english<0)
{printf("Please enter a number between 0 to 100!\n");
goto e;
}
}
head=NULL;
while(p1->num!=0)
{
n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *) malloc(LEN);
printf("\nInput student's number (press 0 to exit): ");
scanf("%ld",&p1->num);
if (p1->num!=0)
{printf("Input student's name: ");
scanf("%s",&p1->name);
printf("Input student's sex(f or m): ");
scanf("%s",&p1->sex);
printf("Input Chinese score: ");
scanf("%d",&p1->chinese);
if(p1->chinese>100||p1->chinese<0)
{printf("Please enter a number between 0 to 100\n"); /*验证成绩是否在0——100之间*/
goto c;
}
printf("Input math score: ");
scanf("%d",&p1->math);
if(p1->math>100||p1->math<0)
{printf("Please enter a number between 0 to 100\n"); /*验证成绩是否在0——100之间*/
goto d;
}
printf("Input english score: ");
scanf("%d",&p1->english);
if(p1->english>100||p1->english<0)
{printf("Please enter a number between 0 to 100\n");
goto e;
}
}
}
p2->next=NULL;
return(head);
}
/*输出链表*/
void print(struct student *head)
{
struct student *p;
printf("\n=============Student information=============\n");
printf("\nthe %d recrods are:\n",n);
printf("| NO. | Name | Sex |Chi |math|Eng | sum|\n");
printf("|----------|--------|-----|----|----|----|------|\n");
p=head;
if(p!=NULL)
do
{
p->sum=p->chinese+p->math+p->english;
/*求总分赋给totalscorescore*/
/*输出各项值*/
printf("|%10ld|%8s|%5s|%4d|%4d|%4d|%6d|\n",
p->num, p->name,p->sex,p->chinese,p->math,
p->english,p->sum);
p=p->next; /*将p原来指向的节点中next的值赋给p,使p指向第下一个节点*/
p->sum=NULL; /*将总分totalscorescore赋空地址*/
}while(p!=NULL);
else printf("\nNo records\n");
printf("===============END====================\n") ;
}
/*删除节点*/
struct student *del(struct student *head,long num) /*参数为起始地址head和学号number*/
{
struct student *p1,*p2;
if(head==NULL){printf("\nlist null! \n");}
p1=head;
while (num!=p1->num&&p1->next!= NULL) /**p1指向的不是所要找的节点,并且后面还有节点*/
{
p2=p1;p1=p1->next; /**p1后移一个节点*/
}
if(num==p1->num)
{
if(p1==head)head=p1->next; /*若p1指向的是头节点,把第二个节点地址赋予head*/
else p2->next=p1->next; /*否则将下一节点地址赋给前一节点地址*/
printf("delete:%ld\n",num);
n=n-1;
}
else printf("%ld not been found!\n",num); /*找不到该节点*/
return(head);
}
/*插入节点*/
struct student *insert(struct student *head,struct student *stud) /*stud是一个指针变量,从实参传来待插入节点的地址给stud*/
{
struct student *p0,*p1,*p2;
p1=head; /*使p1指向第一个节点*/
p0=stud; /*p0指向要插入的节点*/
if(head==NULL) /*原来的链表是空表*/
{head=p0;p0->next=NULL; /*使p0指向的节点作为头节点*/
}
else
{
while((p0->num>p1->num)&&(p1->next!=NULL))
{
p2=p1; /*使p2指向刚才p1指向的节点*/
p1=p1->next; /*p1后移一个节点*/
}
if(p0->num<p1->num)
{
if(head==p1)head=p0; /*插到原来第一个节点之前*/
else p2->next=p0; /*插到p2指向的节点之后*/
p0->next=p1;
}
else
{p1->next=p0;p0->next=NULL;} /*插到最后的节点之后*/
}
n=n+1; /*节点数加1*/
return(head);
}
/*exchange the element of chain*/
void swap(struct student* q1,struct student* q2)
{long temp_num;
char temp_name;
char temp_sex[10];
int temp_chinese;
int temp_math;
int temp_english;
int temp_sum;
char s1[20];
temp_num=q1->num;
q1->num=q2->num;
q2->num=temp_num;
strcpy(s1,q1->name);
strcpy(q1->name,q2->name);
strcpy(q2->name,s1);
temp_sex[10]=q1->sex[10];
q1->sex[10]=q2->sex[10];
q2->sex[10]=temp_sex[10];
temp_chinese=q1->chinese;
q1->chinese=q2->chinese;
q2->chinese=temp_chinese;
temp_english=q1->english;
q1->english=q2->english;
q2->english=temp_english;
temp_math=q1->math;
q1->math=q2->math;
q2->math=temp_math;
temp_sum=q1->sum;
q1->sum=q2->sum;
q2->sum=temp_sum;
}
/*sort by num*/
struct student * sort_num(struct student* head)
{struct student *p0,*p1,*p2;
p0=head;
do{
p1=p0;
p2=p1;
do{
if(p1->num>p2->num) p1=p2;
p2=p2->next;
}while(p2!=NULL);
if(p1!=p0) swap(p0,p1);
p0=p0->next;
}while(p0!=NULL);
return(head);
}
/*sort by totalscore form high to low*/
struct student * sort_sum(struct student* head)
{struct student *p0,*p1,*p2;
p0=head;
do{
p1=p0;
p2=p1;
do{
if(p1->sum<p2->sum) p1=p2;
p2=p2->next;
}while(p2!=NULL);
if(p1!=p0) swap(p0,p1);
p0=p0->next;
}while(p0!=NULL);
return(head);
}
/*主程序*/
main()
{struct student *head,*stu;
char aa;
long del_num;
M:
printf("\n************welcome to the School Management System************\n\n");
printf("***************************************************************\n");
printf("\n************ made by GIS1011 chenliuqing 1020209124 ************\n");
printf("* 1.Input students' records 2.Print students' records *\n* 3.Delete records 4.Insert records *\n* 5.Sort by number 6.Sort by totalscore *\n* 7.System Information 8.Exit *\n ");
printf("********************END****************************************\n");
printf("********* please choose the number before command ***************\n");
aa=getch();
aa=tolower(aa);
switch(aa)
{
case'1': printf("\nInput students' records");
head=creat(); /*返回头指针*/
print(head); /*输出全部节点*/
break;
/*调用输出链表函数*/
case'2':print(head); /*输出全部节点*/
break;
/*调用删除节点函数*/
case'3': printf("\nInput the deleted number(press 0 to exit): ");
scanf("%ld",&del_num);
while(del_num!=0)
{head=del(head,del_num); /*返回头指针*/
print(head); /*输出全部节点*/
printf("\nInput the deleted number(press 0 to exit): ");
scanf("%ld",&del_num);}
break;
/*调用插入节点函数*/
case'4': printf("\nInput the inserted record");
stu=(struct student*)malloc(LEN);
printf("\nInput student's number(press 0 to exit): ");
scanf("%ld",&stu->num);
if (stu->num!=0)
{
printf("Input student's name:");
scanf("%s",stu->name);
printf("Input student's sex(f or m):");
scanf("%s",stu->sex);
printf("Input chinese score: ") ;
scanf("%d",&stu->chinese);
printf("Input math score: ");
scanf("%d",&stu->math);
printf("Input english score: ");
scanf("%d",&stu->english);
}
while(stu->num!=0)
{ head=insert(head,stu);
print(head); /*输出全部节点*/
printf("Input the inserted record");
stu=(struct student *) malloc(LEN);
printf("\nInput student's number(press 0 to exit): ");
scanf("%ld",&stu->num);
printf("Input student's name: ");
scanf("%s",stu->name);
printf("Input student's sex(f or m): ");
scanf("%s",stu->sex);
printf("Input Chinese score:") ;
scanf("%d",&stu->chinese);
printf("Input math score:");
scanf("%d",&stu->math);
printf("Input english score:");
scanf("%d",&stu->english);
}
break;
/*调用按学号(从小到大)排序函数*/
case '5':
head=sort_num(head);
print(head); /*输出全部节点*/
break;
/*调用按总分(从高到低)排序函数*/
case '6':
head=sort_sum(head);
print(head); /*输出全部节点*/
break;
case'7':printf("\n~~~~~~~~~~~~System Information~~~~~~~~~~~~\n");
printf("School Management System\nMade By xugaohong\nFinish Time:20##-7-24\nVersion number:1.0\n\n");
printf("~~~~~~~~~~~~~~~~~~ END ~~~~~~~~~~~~~~~~~~\n\n\n"); /*显示系统信息*/
break;
case'8':exit(); /*退出程序*/
/*调用创建链表函数*/
}
goto M; /*返回、显示主菜单*/
}
五、实习心得体会
由于本课题中的许多知识点都没有学过都要靠自己到课外的资料中去查找。在用的时候难免出现这样那样的错误。如开始设计出来的菜单不是预想的那样,而是总个窗中出现混乱。解决的这个问题的办法是调整。一个系统的菜单和提示信息非常重要。如果没有这些用户根本不知道怎么用你设计的这个系统。在设计的调试过程中也无法顺利的完成调试工作。有了一个清晰简单的菜单和一些提示信息这后,调试过程完成的非常顺利。通过本次C语言程序设计的实习,我学得了很多知识,虽然在之前老师没有详细讲链表的内容,但是我通过自己看书,同学一起讨论,会用链表处理简单的实际问题了,并对链表的建立、结点的插入、删除节点以及链表的输出等一系列链表知识有了较为深刻的认识。而且自己的实际操作能力也有了提高。
回顾起此次课程设计,我感慨颇多,的确,从拿到题目到完成整个编程,从理论到实践,在整整两个礼拜的日子里,可以学到很多很多的东西,同时不仅可以巩固了以前所学过的知识,而且学到了很多在书本上所没有学到过的知识。通过这次课程设计使我们懂得了理论与实际相结合是很重要的,只有理论知识是远远不够的,只有把所学的理论知识与实践相结合起来,从理论中得出结论,才能真正为社会服务,从而提高自己的实际动手能力和独立思考的能力。在设计的过程中遇到问题,可以说得是困难重重,这毕竟第一次做的,难免会遇到过各种各样的问题,同时在设计的过程中发现了自己的不足之处,对以前所学过的知识理解得不够深刻,掌握得不够牢固,比如说结构体……通过这次课程设计之后,一定把以前所学过的知识熟悉了,本次课程设计结束了,我们通过这次实践学到了许多知识。学到了设计一个简单的系统。要注意哪些方面。也使我们知道自己哪些方面做得还不够。这不仅是程序设计,更是锻炼我们处理问题的能力,同时也使我们了解到团队合作的可贵.编写程序是件细心活,稍不留神就会出错,这就必须要求我们对待事情要认真!在编写程序的过程中,错误不断出现,不同的类型(如少写了一个符号,写错了字母,用错了函数等等)层出不穷,这考验我们待事细心,耐心,能不能坚持到底,不能半途而废。
但我们总结出了一点点的经验如下:
1、要对系统的功能和要求做出详细的分析,并合理分解任务。
2、把分解出来的子任务,做给一个相对独立的模块。
3、在设计一个模块之前,要简单构想一下总界面的显视情况。
4、针对构想出来的界面进行程序的编写。
六、附录:
参考文献
教材和主要参考书目:
(1)教材:《C程序设计》,谭浩强编著,清华大学出版社
(2)主要参考书目:
①《C程序设计教程》,谭浩强编著,清华大学出版社;
②《C语言程序设计——习题与实验指导》,谭浩强编著,清华大学出版社。