学生考勤管理系统报告2Word格式.docx
《学生考勤管理系统报告2Word格式.docx》由会员分享,可在线阅读,更多相关《学生考勤管理系统报告2Word格式.docx(29页珍藏版)》请在冰豆网上搜索。
intstudent_num;
FILE*fp1;
structxueke
{unsignedcharxueke_name[50];
intpeople_num;
};
structxuekea[10];
structstudent
{unsignedcharname[50];
longtime;
intlesson_time;
unsignedcharlesson_name[50];
intchidao_num;
intzaotui_num;
intqingjia_num;
intkuangke_num;
structstudent*next;
voidchaxun(structstudent*head)
{inti;
unsignedcharchaxun_name[50];
cout<
<
"
请输入要查询的人名【若没有这个人则不显示】:
endl;
cin>
>
%s"
chaxun_name;
structstudent*p;
if(head==NULL)
cout<
联系人为空"
p=head;
for(i=0;
i<
student_num;
i++)
{if(strcmp(chaxun_name,p->
name)==0)
缺课时间:
%ld学生姓名:
%s课程名称:
%s第%d节迟到次数:
%d早退次数:
%d请假次数:
%d旷课次数:
%d\n"
p->
time,p->
name,p->
lesson_name,p->
lesson_time,p->
chidao_num,p->
zaotui_num,p->
qingjia_num,p->
kuangke_num<
p=p->
next;
}
}
structstudent*xiugai(structstudent*head)
{unsignedcharxiugai_name[50];
unsignedcharxiugai_xueke_name[50];
intk;
请输入要修改的学生姓名与学科名称【格式:
学生姓名(空格)学科名称】:
%s%s"
xiugai_name,xiugai_xueke_name;
structstudent*p1,*p2;
p2=(structstudent*)malloc(LEN);
p1=head;
{cout<
没有学生信息\n"
return(head);
while(strcmp(xiugai_name,p1->
name)!
=0&
&
(p1->
next!
=NULL)&
strcmp(xiugai_xueke_name,p1->
lesson_name)!
=0)
p1=p1->
if(strcmp(xiugai_name,p1->
name)==0&
lesson_name)==0)
{cout<
=======================================\n"
1-修改缺课时间\n"
2-修改学生姓名\n"
3-修改课程名称\n"
4-修改第几节缺课\n"
5-修改迟到次数\n"
6-修改早退次数\n"
7-修改请假次数\n"
8-修改旷课次数\n"
cin>
%d"
&
k;
switch(k)
{case1:
cout<
请输入新的缺课时间"
cin>
%ld"
p1->
time;
break;
case2:
请输入新的学生姓名"
p1->
name;
case3:
请输入新的课程名称"
lesson_name;
case4:
请输入新的第几节缺课"
lesson_time;
case5:
请输入新的迟到次数"
chidao_num;
case6:
请输入新的早退次数"
zaotui_num;
case7:
请输入新的请假次数"
qingjia_num;
case8:
请输入新的旷课次数"
kuangke_num;
return(head);
structstudent*creat()
{
inti,b;
structstudent*head,*p1,*p2;
请输入要建立资料的学生人数:
b;
head=p2=NULL;
p1=(structstudent*)malloc(LEN);
【输入格式:
缺课时间(空格)学生姓名(空格)课程名称(空格)第几节(空格)迟到次数(空格)早退次数(空格)请假次数(空格)旷课次数】\n"
请输入第1名学生信息:
<
%ld%s%s%d%d%d%d%d"
time,p1->
name,p1->
lesson_name,&
lesson_time,&
chidao_num,&
zaotui_num,&
qingjia_num,&
head=p1;
p2=p1;
student_num++;
for(i=1;
{
p1=(structstudent*)malloc(LEN);
请输入第%d名学生信息:
i+1<
p2->
next=p1;
p2=p1;
student_num++;
}
p2->
next=NULL;
voidprint(structstudent*head)
{structstudent*p;
if(p==NULL)
while(p!
=NULL)
%d旷课次数:
}
structstudent*tongji_lesson(structstudent*head)
{structstudent*p1,*p2,*p3;
unsignedcharlesson[50];
longlook_time1,look_time2;
intxunhuan_num=0;
p3=(structstudent*)malloc(LEN);
没有学生信息"
p2=p1->
while(xunhuan_num<
student_num)
{while(p2!
if(p2->
kuangke_num>
kuangke_num)
{
p3->
chidao_num=p2->
kuangke_num=p2->
qingjia_num=p2->
zaotui_num=p2->
lesson_time=p2->
time=p2->
strcpy(p3->
lesson_name,p2->
lesson_name);
name,p2->
name);
p2->
chidao_num=p1->
kuangke_num=p1->
qingjia_num=p1->
zaotui_num=p1->
lesson_time=p1->
time=p1->
strcpy(p2->
lesson_name,p1->
p1->
chidao_num=p3->
kuangke_num=p3->
qingjia_num=p3->
zaotui_num=p3->
lesson_time=p3->
time=p3->
strcpy(p1->
lesson_name,p3->
name,p3->
}
p1=p2;
p2=p2->
p1=head;
p2=p1->
xunhuan_num++;
请输入要查看的学科名称:
lesson;
请输入要查看的时间范围【输入格式:
时间(空格)时间】"
%ld%ld"
look_time1,&
look_time2;
while(p1!
{if(strcmp(lesson,p1->
lesson_name)==0&
look_time1<
=p1->
time&
time<
=look_time2)
学生姓名%s旷课次数%d\n"
structstudent*tongji_student(structstudent*head)
intn,i,j,zhongjian;
structstudent*p1;
unsignedcharzhongjian_name[50];
请输入一共的学科数:
n;
请输入第%d个学科名称:
a[i].xueke_name;
a[i].people_num=0;
请输入要查看的时间范围由小到大【输入格式:
{while(p1!
=NULL&
look_time1<
time&
p1->
{if(strcmp(a[i].xueke_name,p1->
a[i].people_num+=p1->
p1=p1->
for(j=0;
j<
n-1;
j++)
for(i=0;
n-1-j;
{if(a[i].people_num<
a[i+1].people_num)
{zhongjian=a[i+1].people_num;
a[i+1].people_num=a[i].people_num;
a[i].people_num=zhongjian;
strcpy(zhongjian_name,a[i+1].xueke_name);
strcpy(a[i+1].xueke_name,a[i].xueke_name);
strcpy(a[i].xueke_name,zhongjian_name);
学科名称%s旷课人%d\n"
a[i].xueke_name,a[i].people_num<
structstudent*zairu()
{structstudent*p1=NULL,*p2=NULL,*head=NULL;
structstudentstudent_ziliao[100];
inti=0,n=0;
if((fp1=fopen("
xueshengziliao.txt"
"
rb+"
))==NULL)
cannotopenfile\n"
while(!
feof(fp1))
{if(fread(&
student_ziliao[i],LEN,1,fp1)!
=1)
{if(feof(fp1))
{fclose(fp1);
break;
filereaderror\n"
i++;
n=i;
p1=p2=(structstudent*)malloc(LEN);
head=p1;
{p1->
chidao_num=student_ziliao[i].chidao_num;
p1->
kuangke_num=student_ziliao[i].kuangke_num;
strcpy(p1->
lesson_name,student_ziliao[i].lesson_name);
lesson_time=student_ziliao[i].lesson_time;
name,student_ziliao[i].name);
qingjia_num=student_ziliao[i].qingjia_num;
time=student_ziliao[i].time;
zaotui_num=student_ziliao[i].zaotui_num;
p2->
p1=(structstudent*)malloc(LEN);
voidchucun(structstudent*head)
{structstudent*p1;
fp1=fopen("
wb+"
);
{fwrite(p1,LEN,1,fp1);
fclose(fp1);
储存成功\n"
voidmain()
structstudent*head;
intm;
do
{
***************************************************\n"
1_建立学生缺课记录\n"
2_修改学生缺课记录\n"
3_查询学生缺课记录\n"
4_查看单科旷课记录\n"
5_查看学生旷课记录\n"
6_载入学生旷课记录\n"
7_储存学生旷课记录\n"
8_退出考勤管理程序\n"
m;
switch(m)
case1:
head=creat();
print(head);
head=xiugai(head);
chaxun(head);
head=tongji_lesson(head);
head=tongji_student(head);
head=zairu();
print(head);
chucun(head);
}while(m!
=8);