最新基于Linux系统的学生信息管理系统Word格式.docx
《最新基于Linux系统的学生信息管理系统Word格式.docx》由会员分享,可在线阅读,更多相关《最新基于Linux系统的学生信息管理系统Word格式.docx(19页珍藏版)》请在冰豆网上搜索。
![最新基于Linux系统的学生信息管理系统Word格式.docx](https://file1.bdocx.com/fileroot1/2022-10/26/813aeb8e-6e0c-4fe1-b284-19793cc2ea49/813aeb8e-6e0c-4fe1-b284-19793cc2ea491.gif)
退出则会退出此程序。
以下具体介绍每个权限中的具体功能:
1.学生界面:
学生的功能包括查看学生信息,考试,提交试卷,修改密码,返回以及退出的功能。
将各个函数封装成一个box,然后在主函数中进行调用,具体代码如下:
①box中的各函数:
#include"
stu_box.h"
#include<
stdio.h>
stdlib.h>
string.h>
staticvoidinit_node(structstu_info*head,structstu_infoinfo)
{
strcpy(head->
name,info.name);
sex,info.sex);
head->
age=info.age;
cid,info.cid);
tel,info.tel);
addr,info.addr);
object,info.object);
next=head;
prev=head;
}
staticvoid__add(structstu_info*a,structstu_info*new,structstu_info*b)
a->
next=new;
new->
next=b;
b->
prev=new;
prev=a;
staticintadd(structstu_info*head,structstu_infoinfo)
structstu_info*new=NULL;
new=(structstu_info*)malloc(sizeof(structstu_info));
init_node(new,info);
__add(head,new,head->
next);
return1;
staticintread_from_stdin(structstu_box*box)
structstu_info*head=box->
head;
structstu_infoinfo;
printf("
\t\t\t\t\t\t请输入学生信息:
\n"
);
\t\t\t\t\t\t例如:
张山男23123456789136000000上海市嵌入式\n\t\t\t\t\t\t"
scanf("
%s%s%d%s%s%s%s"
info.name,info.sex,&
info.age,info.cid,info.tel,
info.addr,info.object);
add(head,info);
staticintread_from_file(structstu_box*box)
//1.fopen
FILE*fp=NULL;
fp=fopen("
dat/stu_info.dat"
"
r+"
if(fp==NULL)
{
perror("
fopen"
return-1;
}
while((fscanf(fp,"
info.addr,info.object))!
=EOF)
add(head,info);
fclose(fp);
return0;
staticintedit(structstu_box*box)
staticintdisplay(structstu_box*box)
structstu_info*tmp=box->
for(tmp=box->
head->
next;
tmp!
=box->
tmp=tmp->
next)
printf("
\t\t\t\t%s\t%s\t%d\t%s\t%s\t%s\t%s\n"
tmp->
name,tmp->
sex,tmp->
age,tmp->
cid,tmp->
tel,
addr,tmp->
object);
staticvoidinit_head(structstu_info*head)
structstu_infoinfo={"
abc"
男"
22,"
123456789012345678"
123456789"
上海市"
嵌入式"
};
init_node(head,info);
staticintdel(structstu_box*box)
charname[32];
\t\t\t\t\t\t请输入需要删除学生的姓名:
\n\t\t\t\t\t\t"
%s"
name);
if(strcmp(tmp->
name,name)==0)
{
prev->
next=tmp->
next->
prev=tmp->
prev;
init_head(tmp);
free(tmp);
break;
}
staticintsave(structstu_box*box)
structstu_info*tmp=NULL;
//1.打开文件
"
w+"
fopen()"
for(tmp=head->
=head;
tmp=tmp->
//2.往文件里面写入
fprintf(fp,"
%s%s%d%s%s%s%s\n"
//3.关闭文件
structstu_box*init_stu_box()
structstu_box*box=NULL;
box=(structstu_box*)malloc(sizeof(structstu_box));
//创建链表
structstu_info*head=NULL;
head=(structstu_info*)malloc(sizeof(structstu_info));
init_head(head);
box->
head=head;
edit=edit;
del=del;
display=display;
save=save;
readin=read_from_stdin;
readfp=read_from_file;
returnbox;
②主函数:
user_box.h"
unistd.h>
time.h>
user.h"
staticvoiddisplay_menu()
//system("
clear"
\t\t\t\t\t\t*****************************************\n"
\t\t\t\t\t\t**\n"
\t\t\t\t\t\t*1.查看学生信息*\n"
\t\t\t\t\t\t*2.考试*\n"
\t\t\t\t\t\t*3.提交试卷*\n"
\t\t\t\t\t\t*4.修改密码*\n"
\t\t\t\t\t\t*5.返回*\n"
\t\t\t\t\t\t*0.退出*\n"
voiddisplay_stu_info(structstu_box*box)
readfp(box);
system("
\n\n\n\n\n"
\t\t\t\t*****学生信息*****\n"
\n\n\t\t\t\t+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
display(box);
\t\t\t\t+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
save(box);
//考