最新C语言之学生管理系统文档格式.docx

上传人:b****2 文档编号:15063786 上传时间:2022-10-27 格式:DOCX 页数:19 大小:135.90KB
下载 相关 举报
最新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

};

//定义一个结构题

intTOTAL_NUM=0;

//学生总数

structstudent*head=NULL;

voidmainmenu();

//主界面

voidrecord();

//记录数据

voidinsert(structstudent*stu);

//插入数据

voiddisplay(structstudent*stu);

//显示一个学生的信息

voiddisplayAll();

//显示所有学生的信息

voidquery();

//查询学生信息

voidquery_by_num();

//按学号查询学生信息

voidquery_by_name();

voidreadData();

//读取文件里学生的信息

voidwriteData();

//向文件写入学生信息

voidfreeAll();

//清空链表内容

voiddel();

//删除学生信息

voidchange();

//更改学生信息

voidsort();

//排序

voiddevise(structstudent*p);

//选择更改内容

intmain(void)

mainmenu();

return0;

}

//系统主菜单

voidmainmenu()

intchoice;

choice=-1;

readData();

printf("

\t\t\t----------------------------------------------------\n"

);

\t\t\t|欢迎使用通信工程专业学生信息管理系统|\n"

\t\t\t本程序需要在当前目录下建立student.txt才可正常运行\n"

do

{

\n\n\n"

\t\t\t--------------------------------------------\n"

\t\t\t通信工程专业学生信息管理系统|\n"

\t\t\t[1]----录入学生信息|\n"

\t\t\t[2]----浏览学生信息|\n"

\t\t\t[3]----查询学生信息|\n"

\t\t\t[4]----删除学生信息|\n"

\t\t\t[5]----修改学生信息|\n"

\t\t\t[6]----排序|\n"

\t\t\t[0]----退出系统|\n"

请输入您的选择"

scanf("

%d"

&

choice);

switch(choice)

case0:

writeData();

freeAll();

exit(0);

case1:

record();

break;

case2:

displayAll();

case3:

query();

case4:

del();

case5:

change();

case6:

sort();

default:

printf("

\n无效选项!

"

}

}while(choice!

=0);

//录入学生信息

voidrecord()

structstudent*p0;

p0=(structstudent*)malloc(LEN);

\t\t\t请输入学生的姓名:

%s"

p0->

name);

\t\t\t请输入学生的学号:

%ld"

&

p0->

num);

\t\t\t请输入学生的性别:

sex);

\t\t\t请输入学生的年龄:

age);

\t\t\t请输入学生的地址:

address);

\t\t\t请输入学生的成绩:

%f"

score);

insert(p0);

\t\t\t该学生的信息为:

\n"

\t\t\t-------------------------------------------------------------------------------\n"

\t\t\t姓名\t学号\t\t年龄\t性别\t地址\t\t成绩\n"

display(p0);

voidinsert(structstudent*stu)

structstudent*p0,*p1,*p2;

p1=head;

p0=stu;

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)

p2->

next=p0;

next=p1;

TOTAL_NUM++;

voiddisplay(structstudent*p)

\t\t\t%s\t%ld\t\t%d\t%s\t%s\t\t%f\n"

p->

name,p->

num,p->

age,p->

sex,p->

address,p->

//浏览学生信息

voiddisplayAll()

structstudent*p;

printf("

\t\t\t学生总数:

%d\n"

TOTAL_NUM);

p=head;

if(head!

=NULL)

do

display(p);

p=p->

while(p!

=NULL);

voidquery()

--------------------\n"

|按学号查询请按1|\n"

|按姓名查询请按2|\n"

|取消请按0|\n"

+--------------------+\n"

scanf("

switch(choice)

return;

query_by_num();

query_by_name();

printf("

while(choice!

//按姓名查询学生信息

voidquery_by_name()

structstudent*p1;

请输入学生的姓名"

name);

if(head==NULL)

{printf("

无学生记录\n"

return;

p1=head;

while(strcmp(name,p1->

name)&

next!

=NULL)

p1=p1->

if(!

strcmp(name,p1->

name))

display(p1);

没有该学生记录请核对"

//按学号查询学生信息

voidquery_by_num()

intnum;

请输入学生的学号"

无学生记录\n"

wh

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

当前位置:首页 > 人文社科 > 法律资料

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

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