C语言学生信息管理系统实验报告Word格式.docx

上传人:b****2 文档编号:5998076 上传时间:2023-05-05 格式:DOCX 页数:31 大小:29.15KB
下载 相关 举报
C语言学生信息管理系统实验报告Word格式.docx_第1页
第1页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第2页
第2页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第3页
第3页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第4页
第4页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第5页
第5页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第6页
第6页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第7页
第7页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第8页
第8页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第9页
第9页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第10页
第10页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第11页
第11页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第12页
第12页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第13页
第13页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第14页
第14页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第15页
第15页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第16页
第16页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第17页
第17页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第18页
第18页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第19页
第19页 / 共31页
C语言学生信息管理系统实验报告Word格式.docx_第20页
第20页 / 共31页
亲,该文档总共31页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

C语言学生信息管理系统实验报告Word格式.docx

《C语言学生信息管理系统实验报告Word格式.docx》由会员分享,可在线阅读,更多相关《C语言学生信息管理系统实验报告Word格式.docx(31页珍藏版)》请在冰点文库上搜索。

C语言学生信息管理系统实验报告Word格式.docx

学生信息浏览

学生信息查找

学生信息修改

学生信息增加

2.2、函数功能和函数之间的调用关系

2.2.1、函数功能:

voidMenu_1();

voidMenu_2();

//

主菜单二级菜单

voidswap(structstudent*phead,struct

表节点互换

voidSave(structstudent*head);

voidSearch(structstudent*head);

生信息

voidRead(structstudent*head);

voidSort(structstudent*head);

点排序

student*pback);

//

写入磁

查找学

显示学

链表节

structstudent*Create();

录入

structstudent*Readpoint();

structstudent*Modify(structstudent*head);

体成员修改

structstudent*Add(structstudent*head);

点插入

structstudent*Delete(structstudent*head);

点删除

学生信息手动

磁盘文件写入

链表结构

 

2.2.2、函数之间的调用关系:

通过switch语句进行指令选择:

case1:

学生信息录入调用函数Create()、Save()、Menu_1()、Menu_2()

case2:

学生信息浏览

调用函数Readpoint()、Sort()、Read()、Save()、Menu_1()、Menu_2()

case3:

学生信息查找

调用函数Search()、Readpoint()、Menu_1()、Menu_2()

case4:

学生信息修改

调用函数Modify()、Readpoint()、Save()、Menu_1()、Menu_2()

case5:

学生信息增加

调用函数Add()、Readpoint()、Save()、Menu_1()、Menu_2()

case6:

学生信息删除

调用函数Delete()、Readpoint()Save()、Menu_1()、Menu_2()

case0:

返回主菜单

第三章、代码(源代码)

//定义结构体

调用函数Menu_1()

/*

*/

#include<

stdio.h>

#include<

stdlib.h>

string.h>

structstudent

{

intnum;

charname[24];

charsex[5];

intChinese;

intMath;

intEnglish;

structstudent*next;

voidswap(structstudent*phead,structstudent*pback);

链表

节点互换

voidSave(structstudent*head);

写入

磁盘

voidSearch(structstudent*head);

查找

学生信息

voidRead(structstudent*head);

显示

voidSort(structstudent*head);

节点排序

文件写入存

学生信息手动录入

structstudent*Modify(structstudent*head);

结构体成员修改

structstudent*Add(structstudent*head);

节点插入

structstudent*Delete(structstudent*head);

节点删除

};

voidMenu_1();

voidMenu_2();

intmain(void)

Menu_1();

return0;

}

voidMenu_1()

printf("

\t\t\t\t学生信息管理系统\t\t\t\t\n"

);

\t\t\t1:

进入学生信息管理\n"

主菜单

\t\t\t0:

退出学生信息管理\n"

请您输入指令:

"

scanf("

%d"

&

num);

switch(num)

{case1:

Menu_2();

break;

您已退出

default:

学生信息管理系统\n"

/*

*/

voidMenu_2()

1

structstudent*head;

intnum;

\t\t\t

欢迎进入\n"

--\n"

学生信息录入\n"

\t\t\t2:

学生信息浏览\n"

\t\t\t3:

学生信息查找\n"

\t\t\t4:

//二级菜单

学生信息修改\n"

\t\t\t5:

学生信息增加\n"

\t\t\t6:

学生信息删除\n"

返回主菜单\n"

---\n"

scanf("

switch(num)

head=Create();

Save(head);

\n"

返回主菜单\n"

//手动录入学生数据

返回二级菜单\n"

default:

输入无效,返回二级菜单!

Menu_2();

}break;

{head=Readpoint();

//写入链表,返回头指针

Sort(head);

\t\t\t以学号升序排列\n"

Read(head);

//链表数据写入文件

break;

default:

Search(head);

//查找学生信息

head=Readpoint();

Modify(head);

//修改结构体成员并保存到文件

//增加学生信

Add(head);

息并保存到文件

switch(num){case1:

head=Delete(head);

//删除学生信息并保存到文件

{

Menu_1();

请重新输入\n"

-*/structstudent*Create()//学生信息手动录入{

structstudent*head,*p,*q;

intn;

p=q=(structstudent*)malloc(sizeof(structstudent));

请输入学生的、学号、性别、语文成绩、高等数学成绩、英语成绩:

%s"

q->

name);

%d%s%d%d%d"

q->

num,&

sex,&

Chinese,&

Math,&

English);

n=0;

head=NULL;

while(q->

num!

=0)

n=n+1;

if(n==1)head=q;

else

p->

next=q;

p=q;

q=(structstudent*)malloc(sizeof(structstudent));

num,q->

English);

next=NULL;

学生信息录入成功!

returnhead;

--*/

structstudent*Readpoint()

//学生信息写入存,便于操作

{FILE*fp1;

if((fp1=fopen("

E:

test.txt"

"

rb"

))==NULL)

openfileerror!

exit(0);

fscanf(fp1,"

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

name,&

Chinese,&

English);

head=NULL;

while(!

feof(fp1))

if(n==1)

head=q;

Chinese,&

fclose(fp1);

returnhead;

}

voidSwap(structstudent*phead,structstudent*pback)//链表元素数据交换

structstudent*temp=(structstudent*)malloc(sizeof(structstudent));

strcpy(temp->

name,phead->

temp->

num=phead->

num;

strcpy(temp->

sex,phead->

sex);

Chinese=phead->

Chinese;

Math=phead->

Math;

English=phead->

English;

strcpy(phead->

name,pback->

phead->

num=pback->

strcpy(phead->

sex,pback->

Chinese=pback->

Math=pback->

English=pback->

strcpy(pback->

name,temp->

pback->

num=temp->

strcpy(pback->

sex,temp->

Chinese=temp->

Math=temp->

English=temp->

free(temp);

voidSort(structstudent*head)//

structstudent*phead=(structstudent*)malloc(sizeof(structstudent));

structstudent*pback=(structstudent*)malloc(sizeof(structstudent));

phead=head;

while(phead)

intNum=phead->

pback=phead->

next;

while(pback)

if(Num>

num)

Swap(phead,pback);

Num=phead->

}pback=pback->

phead=phead->

-*/

voidRead(structstudent*head)//生信息读取

structstudent*p;

p=head;

\n"

学生的、学号、性别、语文成绩、高等数学成绩成绩:

while(p!

=NULL)

%s\t%d\t%s\t%d\t%d

学号排序

英语

\t\t%d\n"

p->

name,p->

num,p->

sex,p->

Chinese,p->

Math,p->

p=p->

voidSave(structstudent*head)//学生信息保存到文件

FILE*fp;

if((fp=fopen("

wb"

p=head;

=NULL)

fprintf(fp,"

Chinese,p->

\r\n"

p=p->

fclose(fp);

voidSearch(structstudent*head)//学生信息查找

structstudent*p;

charsex[5];

intChinese;

您想以何种方式进行查找:

printf("

1;

2:

学号\n"

3:

性别\n"

4:

语文成绩\n"

5:

数学成绩\n"

6:

英语成绩\n"

0:

n);

switch(n){case1:

按查

请输入:

//找

name);

while(strcmp(name,p->

name)!

=0&

&

p->

next!

=NULL)p=p->

if(strcmp(name,p->

name)==0)

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

Chinese,p->

elseprintf("

查无此人!

请输入学号:

//按学号查找

while(num!

=p->

num&

if(num==p->

请输入性别:

找scanf("

sex);

while(p!

if(strcmp(sex,p->

sex)==0)

请输入语文成绩:

//按语文成绩查找

Chinese);

while(p!

=N

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

当前位置:首页 > 人文社科 > 广告传媒

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

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