数据结构学生成绩管理系统课程设计总结
标准答案给了
⑵ 数据结构课程设计-学生成绩管理系统的设计
好像没有数据结构的 你试试c++语言面向对象程序设计课程设计
这个网站能免费下几个,不能版免费下的就要收权费了
本站免费计算机课程设计论文下载
本人原创计算机类课程设计免费下载,销售计算机毕业论文
请把我的网站介绍给同学们.谢谢支持本站
ACCESS课程设计库存管理工资管理系统 sqlserver数据库课程设计 c++语言面向对象程序设计课程设计 vb课程设计学生成绩系统
asp留言板(没有论文) 计算机实训计算机组装与维护课程设计
简单的网页设计没有论文 office课程设计 操作系统课程设计
另有以上没有列出的计算机课程设计为收费材料30元一份 更多
⑶ 数据结构课程设计:学生成绩管理系统(C++和C),求大神帮帮忙,求代码
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
structSTUDENT{
floatscore[3];
longid;
charnames[20];
};
typedefstructSTUDENTstudent;//simplifythestructSTUDENT
typedefstructSTUDENT*Pstudent;
voidprint();
voidappend();
voidcourse_total();
voidstudent_total();
voidscore_sort(int(*compare)(floata,floatb));
voidnumber_sort();
voidname_sort(Pstudentnames_[30]);
voidnumber_search();
voidname_search();
voidstatistic(Pstudentscores_[30]);
voidshow(inti);
intascend(floata,floatb){
if(a>b)return1;
elsereturn0;
}
intdescend(floata,floatb){
if(a<b)return1;
elsereturn0;
}
intn;//thenumberofstudents
intflg=1;//trueprinttheresult
student*stuArray[30];//
intagain=1;//whethertocontinue
intmain(){
inti;
printf("Inputstudentnumber(n<30):");
scanf("%d",&n);
intchoice;
while(again){
print();
scanf("%d",&choice);
switch(choice){
case1:
append();
break;
case2:
course_total();//useflagtodefinewhethertoprint
break;
case3:
student_total();
break;
case4:
score_sort(descend);
if(flg){
printf(": ");
printf("NO Name MT EN PH SUM AVER ");
for(i=0;i<n;i++)
show(i);
}
break;
case5:
score_sort(descend);
if(flg){
printf(": ");
printf("NO Name MT EN PH SUM AVER ");
for(i=0;i<n;i++)
show(n-1-i);
}
break;
case6:
number_sort();
break;
case7:
name_sort(stuArray);
break;
case8:
number_search();
break;
case9:
name_search();
break;
case10:
statistic(stuArray);
break;
case0:
again=0;
printf("Endofprogram! ");
break;
default:
printf("Inputerror! ");
break;
}
}
return0;
}
voidprint(){
printf("1.Appendrecord ");
printf("2. ");
printf("3. ");
printf("4. ");
printf("5. ");
printf("6.Sortinascendingorderbynumber ");
printf("7.Sortindictionaryorderbyname ");
printf("8.Searchbynumber ");
printf("9.Searchbyname ");
printf("10.Statisticanalysis ");
printf("PleaseInputyourchoice:");
}
voidappend(){
inti;
printf("Inputstudent'sID,nameandscore: ");
for(i=0;i<n;i++){////
stuArray[i]=(student*)malloc(sizeof(student));
scanf("%ld%s",&stuArray[i]->id,stuArray[i]->names);
scanf("%f",&stuArray[i]->score[0]);
scanf("%f",&stuArray[i]->score[1]);
scanf("%f",&stuArray[i]->score[2]);
}
}
voidcourse_total(){
inti;
floatsum0=0.0,sum1=0.0,sum2=0.0;
for(i=0;i<n;i++){
sum0+=stuArray[i]->score[0];
sum1+=stuArray[i]->score[1];
sum2+=stuArray[i]->score[2];
}
if(flg){
printf("course%d:sum=%.0f,aver=%.0f ",1,sum0,sum0/n);
printf("course%d:sum=%.0f,aver=%.0f ",2,sum1,sum1/n);
printf("course%d:sum=%.0f,aver=%.0f ",3,sum2,sum2/n);
}
}
voidstudent_total(){
floattotal[30]={0.0};
inti;
for(i=0;i<n;i++){
total[i]=stuArray[i]->score[0]+stuArray[i]->score[1]+stuArray[i]->score[2];
}
if(flg){
for(i=0;i<n;i++)
printf("student%d:sum=%.0f,aver=%.0f ",i+1,total[i],total[i]/3);
}
}
voidscore_sort(int(*compare)(floata,floatb)){
inti,j;
floattotal[30]={0.0};
for(i=0;i<n;i++){
total[i]=stuArray[i]->score[0]+stuArray[i]->score[1]+stuArray[i]->score[2];
}
for(i=0;i<n;i++){
for(j=0;j<=i;j++)
//if((*compare)(stuArray[i]->score[0]+stuArray[i]->score[1]+stuArray[i]->score[2],stuArray[j]->score[0]+stuArray[j]->score[1]+stuArray[j]->score[2])==0){
if((*compare)(total[i],total[j])==0){//
student*tmp=(student*)malloc(sizeof(student));
memcpy(tmp,stuArray[i],sizeof(student));
memcpy(stuArray[i],stuArray[j],sizeof(student));
memcpy(stuArray[j],tmp,sizeof(student));
}//memcpy->theholethememory
}
}
voidnumber_sort(){//没必要传参
inti,j;
for(i=0;i<n;i++){
for(j=0;j<i;j++)
if(stuArray[i]->id<stuArray[j]->id){
student*tmp=(student*)malloc(sizeof(student));
memcpy(tmp,stuArray[i],sizeof(student));
memcpy(stuArray[i],stuArray[j],sizeof(student));
memcpy(stuArray[j],tmp,sizeof(student));
}
}
if(flg){
printf("Sortinascendingorderbynumber: ");
printf("NO Name MT EN PH SUM AVER ");
for(i=0;i<n;i++)
show(i);
}
}
voidname_sort(Pstudentnames_[30]){
inti,j;
for(i=0;i<n;i++){
for(j=0;j<=i;j++)
if(strcmp(names_[i]->names,names_[j]->names)<0){
student*tmp=(student*)malloc(sizeof(student));
memcpy(tmp,stuArray[i],sizeof(student));
memcpy(stuArray[i],stuArray[j],sizeof(student));
memcpy(stuArray[j],tmp,sizeof(student));
}
}
if(flg){
printf("Sortindictionaryorderbyname: ");
printf("NO Name MT EN PH SUM AVER ");
for(i=0;i<n;i++)
show(i);
}
}
voidnumber_search(){
longquery;
printf("Inputthenumberyouwanttosearch:");
scanf("%ld",&query);
inti;
score_sort(descend);//1009887
for(i=0;i<n;i++){
if(stuArray[i]->id==query)
break;
}
if(i!=n){
printf("%d ",i+1);
show(i);
}
else
printf("Notfound! ");
}
voidname_search(){
charquery[20];
score_sort(descend);
printf("Inputthenameyouwanttosearch:");
scanf("%s",query);
inti;
for(i=0;i<n;i++){
if(!strcmp(query,stuArray[i]->names)){
break;
}
}
if(i!=n){
printf("%d ",i+1);
show(i);
}
else
printf("Notfound! ");
}
voidstatistic(Pstudentscores_[30]){//apointerarraystandsforscores
floatMT[30],EN[30],PH[30];
inti;
for(i=0;i<n;i++){
MT[i]=scores_[i]->score[0];
EN[i]=scores_[i]->score[1];
PH[i]=scores_[i]->score[2];
}
intsta[6]={0};//(<60or60-70....)
for(i=0;i<n;i++){
if(MT[i]<60)
sta[0]++;
if(MT[i]==100)
sta[5]++;
if(MT[i]>=60&&MT[i]<=69)
sta[1]++;
if(MT[i]>=70&&MT[i]<=79)
sta[2]++;
if(MT[i]>=80&&MT[i]<=89)
sta[3]++;
if(MT[i]>=90&&MT[i]<=100)
sta[4]++;
}
if(flg){
printf("Forcourse%d: ",1);
printf("<60 %d %.2f%% ",sta[0],sta[0]/(float)n*100);//changentofloat
printf("60-69 %d %.2f%% ",sta[1],sta[1]/(float)n*100);
printf("70-79 %d %.2f%% ",sta[2],sta[2]/(float)n*100);
printf("80-89 %d %.2f%% ",sta[3],sta[3]/(float)n*100);
printf("90-100 %d %.2f%% ",sta[4],sta[4]/(float)n*100);
printf("100 %d %.2f%% ",sta[5],sta[5]/(float)n*100);
}
memset(sta,0,6*sizeof(int));//initializethestaarray
for(i=0;i<n;i++){
if(EN[i]<60)
sta[0]++;
if(EN[i]==100)
sta[5]++;
if(EN[i]>=60&&EN[i]<=69)
sta[1]++;
if(EN[i]>=70&&EN[i]<=79)
sta[2]++;
if(EN[i]>=80&&EN[i]<=89)
sta[3]++;
if(EN[i]>=90&&EN[i]<=100)
sta[4]++;
}
if(flg){
printf("Forcourse%d: ",2);
printf("<60 %d %.2f%% ",sta[0],sta[0]/(float)n*100);//changentofloat
printf("60-69 %d %.2f%% ",sta[1],sta[1]/(float)n*100);
printf("70-79 %d %.2f%% ",sta[2],sta[2]/(float)n*100);
printf("80-89 %d %.2f%% ",sta[3],sta[3]/(float)n*100);
printf("90-100 %d %.2f%% ",sta[4],sta[4]/(float)n*100);
printf("100 %d %.2f%% ",sta[5],sta[5]/(float)n*100);
}
memset(sta,0,6*sizeof(int));
for(i=0;i<n;i++){
if(PH[i]<60)
sta[0]++;
if(PH[i]==100)
sta[5]++;
if(PH[i]>=60&&PH[i]<=69)
sta[1]++;
if(PH[i]>=70&&PH[i]<=79)
sta[2]++;
if(PH[i]>=80&&PH[i]<=89)
sta[3]++;
if(PH[i]>=90&&PH[i]<=100)
sta[4]++;
}
if(flg){
printf("Forcourse%d: ",3);
printf("<60 %d %.2f%% ",sta[0],sta[0]/(float)n*100);//changentofloat
printf("60-69 %d %.2f%% ",sta[1],sta[1]/(float)n*100);
printf("70-79 %d %.2f%% ",sta[2],sta[2]/(float)n*100);
printf("80-89 %d %.2f%% ",sta[3],sta[3]/(float)n*100);
printf("90-100 %d %.2f%% ",sta[4],sta[4]/(float)n*100);
printf("100 %d %.2f%% ",sta[5],sta[5]/(float)n*100);
}
}
voidshow(inti){
printf("%ld %s ",stuArray[i]->id,stuArray[i]->names);//orderistheidaftersort
printf("%.0f %.0f %.0f ",stuArray[i]->score[0],stuArray[i]->score[1],stuArray[i]->score[2]);
floatsum=stuArray[i]->score[0]+stuArray[i]->score[1]+stuArray[i]->score[2];
printf("%.0f %.0f ",sum,sum/3);
}
⑷ 数据结构课程设计--学生成绩管理系统C语言
一、需求分析
1. 系统菜单的主要功能
(1)输入若干条记录
(2)查找并修改记录
(3)查找并删除记录
(4)成绩排序
(5)查找并显示一条记录
(6)将数据载入内存中
(7)将所有数据写入文件中
(0)退出程序
2. 功能分析
功能1为输入一条记录到结构体中去。
功能2、3和5算法相似,都是先查找成绩,2、3在此基础上再对查找出的信息进行操作。因为学生姓名定义成了字符数组的形式,因此在运用选择法进行排序的时候,要用到strcmp,strcpy等函数
功能4为成绩排序,可按学生学号排序或某单科成绩或总分排序,并输出相关的学生信息等。
功能6和7是对文件的操作,提前准备好数据。
二、总体设计
“学生成绩管理系统”包括:成绩录入、修改、删除、成绩统计和信息保存、载入这几个模块。
1、 主函数 main()
利用无限次循环while(1)和swithch()实现各函数的调用,系统根据输入的数字选项来调用相应的函数。
2、 菜单选择函数showmenu ();
这是一个无参函数,主要实现“功能选择”的界面,在这个界面里有显示系统的各项功能选单,根据每个功能前面的序号进行选择。等执行完每一个函数功能后,按任一键回到主界面也要通过这个函数来实现!3、 输入记录函数addstudent (stu *s) 这是一个带参函数,用来执行第学生成绩记录的输入,当学生为0时停止输入。
算法:利用函数参数s,并将s->next设为NULL。每输入一个数据就声明一个新节点p,把p->next设为NULL,并且链接到之前列表的尾端。4、 显示记录函数showstudent (stu *s) 这是一个不返回值的有参函数,形参为“链表头的指针”,负责对全部学生成绩记录的输出,不足之处就是不能对学生成绩进行分页显示。 算法:先将p结点的指针指向第一个结点,将p结点(即第一个结点)的数据输出。然后再将p结点的指针指向p指针的的指针(即下一结点),将p结点(即第一结点)的数据输出。重复执行此步聚直到p指针指向NULL为止。5、 查找记录函数findstudent (stu *s) 这是一个不返回值的有参函数,形参为“链表头的指针”,实现按学号对某个学生进行查找,并显示所查找到的记录。 算法:采用线性查找法往下一个节点查找。输入所要查找的学生的学号s,设一个指针变量p,先指向第一个结点,当strcmp(p->name,s) && p != NULL时,使p后移一个结点,如果p!=NULL,输出p所指的结点。6、 删除记录函数delstudent (stu *s) 这是一个有参函数,形参为“链表头的指针”,先输入要删除的学生记录的学号,找到后显示该学生信息,等确认后便可按“Y”进行删除。 算法:从p指向的第一个结点开始,检查该结点中的num值是否等于输入的要求删除的那个学号。如果相等就将该结点删除,如不相等,就将p后移一个结点,再如此进行下去,直到遇到表尾为止。7、保存数据到文件函数savestudent (stu *s) 这是一个不返回值的有参函数,形参为“链表头的指针”,可以把学生记录保存在电脑上由自己任意命名的二进制文件。8、从文件读数据函数loadstudent (stu *s) 这是一个不返回值的有参函数,形参为“链表头的指针”,根据输入的文件地址进行读取。
三、程序流程图
1)成绩统计:
2)信息录入:
3)信息修改:
4)信息删除:
4)信息查询:
4)信息保存:5)主函数:
四、程序调试及体会
1)程序演示:
2)程序调试:
(1)刚开始没有那个初始化函数,程序运行后,没有输入任何数据就试得去执行显示功能,结果显示的是一些乱码!加入初始化函数后,这种现象也随之消失。
(2)刚开始执行输入函数,按学号顺序输入十个学生的成绩,输完后执行显示功能,学生成绩记录是按学号的反顺序显示的,试着在其中增加一些语句,希望能把学号按正常顺序显示,但暂时没有成功,所以在输入成绩时只能按学号反顺序输入,最后就按学号正常顺序输出了。
(3)刚开始时,先把成绩按平均分排序,再插入一个学生的成绩,执行显示功能,虽然插入的学生的成绩能正常插入,但该学生的名次为0。后来,在插入成绩之后,调用排序函数,把所有成绩重新排序一次。
(4)在输入函数中设了一个无限循环,可以输入无数个学生的成绩信息,当学号为0的时候则停止输入。
(5)输入太多个学生的成绩时,屏幕显示不能控制为一页一页显示,所以为了方便起见,不要输入太多记录,十七左右为最佳。
(6)在没有输入任何信息的情况下,去执行排序功能,最后显示有一个记录,学号、姓名为空白,成绩都为0,名次为1。
(7)在输入选项时不能输入字母,否则会死循环,建议不要乱输字母。
3)心得体会:
经过一个星期的课程设计,感觉自己收获不少!
首先是:链表是数据结构的基本体现,所以这个课程设计里面主要都是用链表,而已要达到这样的功能,使用链表相当方便,但不容易理解,所以在这方面我很了很多的时间看课本和参考课外书,使C语言的知识强化了不少。
其次,在做课程设计的过程中,发现了平时很多没有注意到的问题,例如:返回值函数和不返回值函数两者在主函数中的调用是不同的…………
更重要的是,这次课程设计虽然花了我不少时间,但正是这些时间,让我见识到了要学好C语言,数据的处理是相当重要的。这个学生成绩管理系统都是在自己知识范围内完成的,所以界面清晰简单,可能不是很好看,但绝对实用!
从这里我也得到一个体会,做一个程序,或者开发一个软件,应该着重从它的后台制作入手,不能做出一个中看不中用的程序或者软件。
相信这次的课程设计为我以后继续从事计算机工作打了一个小小的开头。
参考书目;
[1]谭浩强. C程序设计(第三版) . 北京:清华大学出版社, 2006
[2]谭浩强. C程序设计上机指导(第三版) . 北京:清华大学出版社, 2005
[3]严蔚敏、吴伟民. 数据结构(C语言版) . 北京:清华大学出版社, 2006
计算机科学与技术系课程设计评分表
⑸ 数据结构课程设计之学生成绩管理系统
有点难
⑹ 数据结构课程设计--学生成绩管理系统
可以通过网络Hi告知我
有时间可以解决你的问题
相关的要求也可以告知我
ES:\\
交易提醒:预付定金是陷阱
⑺ 学生成绩管理系统 课程设计实习报告
学生成绩管理(c语言版)
/*11.3.2 源程序*/
/***********xuesheng.c***********/
/******头文件(.h)***********/
#include "stdio.h" /*I/O函数*/
#include "stdlib.h" /*其它说明*/
#include "string.h" /*字符串函数*/
#include "conio.h" /*屏幕操作函数*/
#include "mem.h" /*内存操作函数*/
#include "ctype.h" /*字符操作函数*/
#include "alloc.h" /*动态地址分配函数*/
#define N 3 /*定义常数*/
typedef struct z1 /*定义数据结构*/
{
char no[11];
char name[15];
int score[N];
float sum;
float average;
int order;
struct z1 *next;
}STUDENT;
/*以下是函数原型*/
STUDENT *init(); /*初始化函数*/
STUDENT *create(); /*创建链表*/
STUDENT *delete(STUDENT *h); /*删除记录*/
void print(STUDENT *h); /* 显示所有记录*/
void search(STUDENT *h); /*查找*/
void save(STUDENT *h); /*保存*/
STUDENT *load(); /*读入记录*/
void computer(STUDENT *h); /*计算总分和均分*/
STUDENT *insert(STUDENT *h); /*插入记录*/
void append(); /*追加记录*/
void (); /*复制文件*/
STUDENT *sort(STUDENT *h); /*排序*/
STUDENT *index(STUDENT *h); /*索引*/
void total(STUDENT *h); /*分类合计*/
int menu_select(); /*菜单函数*/
/******主函数开始*******/
main()
{
int i;
STUDENT *head; /*链表定义头指针*/
head=init(); /*初始化链表*/
clrscr(); /*清屏*/
for(;;) /*无限循环*/
{
switch(menu_select()) /*调用主菜单函数,返回值整数作开关语句的条件*/
{ /*值不同,执行的函数不同,break 不能省略*/
case 0:head=init();break; /*执行初始化*/
case 1:head=create();break; /*创建链表*/
case 2:head=delete(head);break; /*删除记录*/
case 3:print(head);break; /*显示全部记录*/
case 4:search(head);break; /*查找记录*/
case 5:save(head);break; /*保存文件*/
case 6:head=load(); break; /*读文件*/
case 7:computer(head);break; /*计算总分和均分*/
case 8:head=insert(head); break; /*插入记录*/
case 9:();break; /*复制文件*/
case 10:head=sort(head);break; /*排序*/
case 11:append();break; /*追加记录*/
case 12:head=index(head);break; /*索引*/
case 13:total(head);break; /*分类合计*/
case 14:exit(0); /*如菜单返回值为14程序结束*/
}
}
}
/*菜单函数,返回值为整数*/
menu_select()
{
char *menu[]={"***************MENU***************", /*定义菜单字符串数组*/
" 0. init list", /*初始化*/
" 1. Enter list", /*输入记录*/
" 2. Delete a record from list", /*从表中删除记录*/
" 3. print list ", /*显示单链表中所有记录*/
" 4. Search record on name", /*按照姓名查找记录*/
" 5. Save the file", /*将单链表中记录保存到文件中*/
" 6. Load the file", /*从文件中读入记录*/
" 7. compute the score", /*计算所有学生的总分和均分*/
" 8. insert record to list ", /*插入记录到表中*/
" 9. the file to new file", /*复制文件*/
" 10. sort to make new file", /*排序*/
" 11. append record to file", /*追加记录到文件中*/
" 12. index on nomber", /*索引*/
" 13. total on nomber", /*分类合计*/
" 14. Quit"}; /*退出*/
char s[3]; /*以字符形式保存选择号*/
int c,i; /*定义整形变量*/
gotoxy(1,25); /*移动光标*/
printf("press any key enter menu......\n"); /*压任一键进入主菜单*/
getch(); /*输入任一键*/
clrscr(); /*清屏幕*/
gotoxy(1,1); /*移动光标*/
textcolor(YELLOW); /*设置文本显示颜色为黄色*/
textbackground(BLUE); /*设置背景颜色为蓝色*/
gotoxy(10,2); /*移动光标*/
putch(0xc9); /*输出左上角边框┏*/
for(i=1;i<44;i++)
putch(0xcd); /*输出上边框水平线*/
putch(0xbb); /*输出右上角边框 ┓*/
for(i=3;i<20;i++)
{
gotoxy(10,i);putch(0xba); /*输出左垂直线*/
gotoxy(54,i);putch(0xba);
} /*输出右垂直线*/
gotoxy(10,20);putch(0xc8); /*输出左上角边框┗*/
for(i=1;i<44;i++)
putch(0xcd); /*输出下边框水平线*/
putch(0xbc); /*输出右下角边框┛*/
window(11,3,53,19); /* 制作显示菜单的窗口,大小根据菜单条数设计*/
clrscr(); /*清屏*/
for(i=0;i<16;i++) /*输出主菜单数组*/
{
gotoxy(10,i+1);
cprintf("%s",menu[i]);
}
textbackground(BLACK); /*设置背景颜色为黑色*/
window(1,1,80,25); /*恢复原窗口大小*/
gotoxy(10,21); /*移动光标*/
do{
printf("\n Enter you choice(0~14):"); /*在菜单窗口外显示提示信息*/
scanf("%s",s); /*输入选择项*/
c=atoi(s); /*将输入的字符串转化为整形数*/
}while(c<0||c>14); /*选择项不在0~14之间重输*/
return c; /*返回选择项,主程序根据该数调用相应的函数*/
}
STUDENT *init()
{
return NULL;
}
/*创建链表*/
STUDENT *create()
{
int i; int s;
STUDENT *h=NULL,*info; /* STUDENT指向结构体的指针*/
for(;;)
{
info=(STUDENT *)malloc(sizeof(STUDENT)); /*申请空间*/
if(!info) /*如果指针info为空*/
{
printf("\nout of memory"); /*输出内存溢出*/
return NULL; /*返回空指针*/
}
inputs("enter no:",info->no,11); /*输入学号并校验*/
if(info->no[0]=='@') break; /*如果学号首字符为@则结束输入*/
inputs("enter name:",info->name,15); /*输入姓名,并进行校验*/
printf("please input %d score \n",N); /*提示开始输入成绩*/
s=0; /*计算每个学生的总分,初值为0*/
for(i=0;i<N;i++) /*N门课程循环N次*/
{
do{
printf("score%d:",i+1); /*提示输入第几门课程*/
scanf("%d",&info->score[i]); /*输入成绩*/
if(info->score[i]>100||info->score[i]<0) /*确保成绩在0~100之间*/
printf("bad data,repeat input\n"); /*出错提示信息*/
}while(info->score[i]>100||info->score[i]<0);
s=s+info->score[i]; /*累加各门课程成绩*/
}
info->sum=s; /*将总分保存*/
info->average=(float)s/N; /*求出平均值*/
info->order=0; /*未排序前此值为0*/
info->next=h; /*将头结点做为新输入结点的后继结点*/
h=info; /*新输入结点为新的头结点*/
}
return(h); /*返回头指针*/
}
/*输入字符串,并进行长度验证*/
inputs(char *prompt, char *s, int count)
{
char p[255];
do{
printf(prompt); /*显示提示信息*/
scanf("%s",p); /*输入字符串*/
if(strlen(p)>count)printf("\n too long! \n"); /*进行长度校验,超过count值重输入*/
}while(strlen(p)>count);
strcpy(s,p); /*将输入的字符串拷贝到字符串s中*/
}
/*输出链表中结点信息*/
void print(STUDENT *h)
{
int i=0; /* 统计记录条数*/
STUDENT *p; /*移动指针*/
clrscr(); /*清屏*/
p=h; /*初值为头指针*/
printf("\n\n\n****************************STUDENT********************************\n");
printf("|rec|nO | name | sc1| sc2| sc3| sum | ave |order|\n");
printf("|---|----------|---------------|----|----|----|--------|-------|-----|\n");
while(p!=NULL)
{
i++;
printf("|%3d |%-10s|%-15s|%4d|%4d|%4d| %4.2f | %4.2f | %3d |\n", i, p->no,p->name,p->score[0],p->score[1],
p->score[2],p->sum,p->average,p->order);
p=p->next;
}
printf("**********************************end*********************************\n");
}
/*删除记录*/
STUDENT *delete(STUDENT *h)
{
STUDENT *p,*q; /*p为查找到要删除的结点指针,q为其前驱指针*/
char s[11]; /*存放学号*/
clrscr(); /*清屏*/
printf("please deleted no\n"); /*显示提示信息*/
scanf("%s",s); /*输入要删除记录的学号*/
q=p=h; /*给q和p赋初值头指针*/
while(strcmp(p->no,s)&&p!=NULL) /*当记录的学号不是要找的,或指针不为空时*/
{
q=p; /*将p指针值赋给q作为p的前驱指针*/
p=p->next; /*将p指针指向下一条记录*/
}
if(p==NULL) /*如果p为空,说明链表中没有该结点*/
printf("\nlist no %s student\n",s);
else /*p不为空,显示找到的记录信息*/
{
printf("*****************************have found***************************\n");
printf("|no | name | sc1| sc2| sc3| sum | ave |order|\n");
printf("|----------|---------------|----|----|----|--------|-------|-----|\n");
printf("|%-10s|%-15s|%4d|%4d|%4d| %4.2f | %4.2f | %3d |\n", p->no,
p->name,p->score[0],p->score[1],p->score[2],p->sum,
p->average,p->order);
printf("********************************end*******************************\n");
getch(); /*压任一键后,开始删除*/
if(p==h) /*如果p==h,说明被删结点是头结点*/
h=p->next; /*修改头指针指向下一条记录*/
else
q->next=p->next; /*不是头指针,将p的后继结点作为q的后继结点*/
free(p); /*释放p所指结点空间*/
printf("\n have deleted No %s student\n",s);
printf("Don't forget save\n");/*提示删除后不要忘记保存文件*/
}
return(h); /*返回头指针*/
}
⑻ 数据结构课程设计学生成绩管理系统
定义结构体——可将成绩等信息组成链表——排序就选择合适的排序方法(数据结构书里有很多排序方法)——