实验一报告 利用顺序表实现学生信息管理Word下载.docx

上传人:b****4 文档编号:7230495 上传时间:2023-05-08 格式:DOCX 页数:13 大小:122.87KB
下载 相关 举报
实验一报告 利用顺序表实现学生信息管理Word下载.docx_第1页
第1页 / 共13页
实验一报告 利用顺序表实现学生信息管理Word下载.docx_第2页
第2页 / 共13页
实验一报告 利用顺序表实现学生信息管理Word下载.docx_第3页
第3页 / 共13页
实验一报告 利用顺序表实现学生信息管理Word下载.docx_第4页
第4页 / 共13页
实验一报告 利用顺序表实现学生信息管理Word下载.docx_第5页
第5页 / 共13页
实验一报告 利用顺序表实现学生信息管理Word下载.docx_第6页
第6页 / 共13页
实验一报告 利用顺序表实现学生信息管理Word下载.docx_第7页
第7页 / 共13页
实验一报告 利用顺序表实现学生信息管理Word下载.docx_第8页
第8页 / 共13页
实验一报告 利用顺序表实现学生信息管理Word下载.docx_第9页
第9页 / 共13页
实验一报告 利用顺序表实现学生信息管理Word下载.docx_第10页
第10页 / 共13页
实验一报告 利用顺序表实现学生信息管理Word下载.docx_第11页
第11页 / 共13页
实验一报告 利用顺序表实现学生信息管理Word下载.docx_第12页
第12页 / 共13页
实验一报告 利用顺序表实现学生信息管理Word下载.docx_第13页
第13页 / 共13页
亲,该文档总共13页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

实验一报告 利用顺序表实现学生信息管理Word下载.docx

《实验一报告 利用顺序表实现学生信息管理Word下载.docx》由会员分享,可在线阅读,更多相关《实验一报告 利用顺序表实现学生信息管理Word下载.docx(13页珍藏版)》请在冰点文库上搜索。

实验一报告 利用顺序表实现学生信息管理Word下载.docx

————退出函数,退出程序并清空链表空间;

个人小结

程序实现以下功能:

1、以链表的形式存储学生信息;

2、structstudent*SeqList链表初始化:

输入学生信息;

将学生信息存入链表;

3、structstudent*ListDelete删除学生信息;

输入学生学号,删除对应的学生信息;

4、structstudent*ListInsert插入学生信息:

输入要插入的学生对应各项信息,可实现按学号顺序对插入信息进行按从小到大排序;

5、voidShowAll(structstudent*head)显示函数:

动态显示链表内学生信息;

6、voidExit(structstudent*head)退出函数:

退出主函数中switch语句循环并释放相应链表空间;

7、while—scanf—switch结构保持选择界面:

可实现一次输入后程序不退出,可以多次选择程序对应功能,提高程序的实用性与可操作性;

程序存在的问题(BUG):

1、由于是链表形式实现初始化,每次运行都需重新输入学生信息;

可考虑在链表定义部分用{}手动添加学生信息,如:

structstudent

{

intid;

charname[10];

charsex[10];

charclassnumber[10];

chartel[10];

structstudent*next;

}{{41105249,”***”,”女”,”数创二班”,”*******”}};

2、输入学生信息除学号外四项可选择性填写,但是未填项在进行删除插入或者修改操作后,ShowAll显示链表信息中未填的项会出现乱码,但不影响输入的信息及以后该信息的删除插入修改;

3、IMPORTANT!

由于是用while—scanf—switch结构实现程序的多次选择,如在输入信息时,输入空格键超过两个,将会导致程序无限循环;

暂没想到解决方法,所以输入时避免输入空格键

难点分析及进一步工作:

1、主函数保持程序的多次选择;

已解决;

2、链表指针域及数据域在函数间的传递问题;

3、未填项的乱码问题;

进一步完善设想:

新增函数判别输入内容是否为空,为空则输入00来避免出现乱码问题;

4、空格键的无限循环问题;

加入判断输入内容是否为空,为空则重新输入;

5、每次进入程序需重新输入信息;

引进文件,程序退出时,将链表中的学生信息存入文件中,再次打开时再读取该信息;

6、进一步完善程序:

增加按姓名查找或按班级检索功能;

增加成绩输入修改删除功能,并在成绩属性下增加子项,实现多层次信息管理;

编程内容

#include<

stdio.h>

malloc.h>

iostream.h>

#include<

stdlib.h>

string.h>

#defineNULL0

#defineddsizeof(structstudent)

};

intn=0;

structstudent*SeqList(void)************输入学生信息**************

structstudent*p1,*p2,*head=NULL;

p1=p2=(structstudent*)malloc(dd);

printf("

请依次输入学生数据:

学号,姓名,性别,班级,电话\n"

);

scanf("

%d,%s,%s,%s,%s"

&

p1->

id,&

name,&

sex,&

classnumber,&

tel);

head=p1;

for(n=0;

n<

3;

n++)

{

p2->

next=p1;

p2=p1;

if(n==2);

else

{

p1=(structstudent*)malloc(dd);

printf("

scanf("

}

}

p2->

next=NULL;

return(head);

}

structstudent*ListDelete(structstudent*head)**********删除学生信息**************

structstudent*p1,*p2;

intj;

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

\n"

%d"

j);

p1=head;

p2=p1->

next;

n=0;

if(j==p1->

id)

head=p2;

else

for(n=1;

=3;

if(j==p2->

p1->

next=p2->

p1=p2;

p2=p2->

structstudent*ListInsert(structstudent*head)**********插入学生信息**************

structstudent*p1,*p2,*p3;

p2=(structstudent*)malloc(dd);

请依次输入要插入的学生数据:

p2->

if(p2->

id<

head=p2;

head->

p3=p1;

p1=p1->

if(p2->

{p3->

next=p2;

p2->

}

}

if(p1->

p1->

structstudent*ListCorrect(structstudent*head)**********修改学生信息**************

structstudent*p1;

intm;

输入修改的学号:

m);

if(m==p1->

依次输入修改内容:

学号,姓名,性别,班级,电话号码\n"

break;

p1=p1->

}

voidExit(structstudent*head)************退出函数**************

p1=head->

p2=head;

while(p1!

=NULL)

free(p2);

p2=p1;

p1=p1->

exit

(1);

voidShowAll(structstudent*head)************显示函数**************

structstudent*p;

\nNow,these%drecordsare:

n);

p=head;

while(p!

{n++;

%d,%s,%s,%s,%s\n"

p->

id,p->

name,p->

sex,p->

classnumber,p->

p=p->

voidmain()************主函数**************

structstudent*head;

——————————————————————————————\n"

————学号:

41105249—姓名:

***—班级:

数创二班————\n"

——————————————————————————————\n\n\n"

head=SeqList();

请选择1——信息浏览,2——插入学生信息,3——删除学生信息,4——更改学生信息,0--退出程序\n"

m=4;

while(m!

=0)

scanf("

switch(m)

case1:

ShowAll(head);

break;

case2:

head=ListInsert(head);

case3:

head=ListDelete(head);

case4:

head=ListCorrect(head);

case0:

{

chars;

printf("

确定要退出吗?

(Y/N)"

scanf("

%s"

s);

if(s=='

Y'

||s=='

y'

Exit(head);

default:

喵呜伦家听不懂...\n"

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

当前位置:首页 > 农林牧渔 > 畜牧兽医

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

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