考勤管理系统源代码Word格式文档下载.docx

上传人:b****7 文档编号:22475721 上传时间:2023-02-04 格式:DOCX 页数:35 大小:21.41KB
下载 相关 举报
考勤管理系统源代码Word格式文档下载.docx_第1页
第1页 / 共35页
考勤管理系统源代码Word格式文档下载.docx_第2页
第2页 / 共35页
考勤管理系统源代码Word格式文档下载.docx_第3页
第3页 / 共35页
考勤管理系统源代码Word格式文档下载.docx_第4页
第4页 / 共35页
考勤管理系统源代码Word格式文档下载.docx_第5页
第5页 / 共35页
点击查看更多>>
下载资源
资源描述

考勤管理系统源代码Word格式文档下载.docx

《考勤管理系统源代码Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《考勤管理系统源代码Word格式文档下载.docx(35页珍藏版)》请在冰豆网上搜索。

考勤管理系统源代码Word格式文档下载.docx

/*加载文件信息*/

voidresetPassword();

/*重设密码*/

intfun();

/*判断输入选择是否正确*/

worker*head=NULL;

/*链表头指针head*/

writeinfo_flag=0;

/*信息保存标记*/

charpassword[16]="

888888"

;

/*初始密码*/

structtm*timeinfo;

intmain()/*主函数*/

chars[16];

welcome();

/*欢迎界面*/

loadRec();

/*加载文件信息*/

printf("

\n提示:

\n\n初始密码为:

888888\n"

);

/*进入系统密码管理*/

\t\t\t\n\n\n\n\n请输入密码,进去系统(密码不超过15个字符):

"

scanf("

%s"

s);

while(strcmp(password,s)!

=0)

{

printf("

\n密码错误,请重新输入:

scanf("

}

system("

cls"

for(;

)/*菜单循环*/

switch(menu_select())

{

case0:

system("

createInfo();

break;

case1:

createRec();

case2:

listRec();

case3:

searchRec();

case4:

deleteRec();

case5:

modifyRec();

case6:

saveRec();

case7:

resetPassword();

case8:

if(writeinfo_flag==1)saveRec();

return0;

default:

{

printf("

\n选择错误,请按回车键返回后,重新输入(0~8)!

getchar();

getchar();

system("

break;

}

}

return0;

}

/*选择菜单*/

intmenu_select()

worker*p=head;

intc,k;

time_tnowtime;

time(&

nowtime);

timeinfo=localtime(&

\t\t**************选择菜单**************\t"

/*在菜单中显示当前时间*/

if(timeinfo->

tm_wday==0)

时间:

星期天"

%d:

%d"

timeinfo->

tm_hour,timeinfo->

tm_min);

else

星期%d%d:

tm_wday,timeinfo->

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

\t\t\t0.新建职工信息\n"

\t\t1.录入考勤信息\n"

\t\t2.浏览考勤信息\n"

\t\t3.查询考勤信息\n"

\t\t4.删除考勤信息\n"

\t\t5.修改考勤信息\n"

\t\t6.保存所有信息\n"

\t\t7.重设密码\n"

\t\t8.退出(退出后信息会自动保存在磁盘中)\n\t\t(任何情况下按Ctrl+C退出程序)\n"

\n\n请输入您的选择(0~8):

&

c);

tm_wday==0&

&

p!

=NULL)/*每周周日所有考勤信息初始化*/

for(k=0;

k<

20;

k++)

p->

time[k].hour=88;

time[k].minute=88;

returnc;

voidloadRec()/*从磁盘导入信息*/

worker*rear,*p,*pre;

FILE*fp,*key;

inti,pos=0;

key=fopen("

key.txt"

"

r"

if(key!

=NULL)

fscanf(key,"

password);

fclose(key);

fp=fopen("

workerRec.txt"

if(fp!

=NULL)

fseek(fp,0,SEEK_END);

/*指针移到文件末尾*/

pos=ftell(fp);

if(fp==NULL||0==pos)/*打开职工信息文件和密码文件*/

\n\n\n\n\n\n\t\t提示:

\n\n\t\t数据库中没有职工信息,文本为空或文件不存在!

\n"

\n\t\t请按回车键进入主菜单新建职工信息^_^\n"

getchar();

system("

/*清屏*/

return;

fseek(fp,0,SEEK_SET);

/*指针移到文件开头*/

while(!

feof(fp))/*fp不指向文件末尾*/

p=(worker*)malloc(sizeof(worker));

/*开辟一个新单元*/

fscanf(fp,"

%s%s"

p->

id,p->

name);

for(i=0;

i<

i++)

fscanf(fp,"

%d%d"

p->

time[i].hour,&

time[i].minute);

if(head==NULL)

head=p;

pre=p;

rear=p;

else

{

rear->

next=p;

pre=rear;

pre->

next=NULL;

fclose(fp);

/*关闭文件*/

return;

voidcreateInfo()/*新建职工信息*/

worker*p,*rear;

inti,k,n;

chars[10];

if(head!

\n\n\n\n\n\n\n\t\t\t职工信息数据库已存在\n\n\t\t\t新建职工信息将续接在信息库的后面\n\n\n\t\t\t按回车键继续"

rear=head;

while(rear->

next!

rear=rear->

next;

\n\n请输入希望建立职工信息条数:

if(fun(s)==0)

n=atoi(s);

\n请输入职工的工号(至多6个字符)和姓名(至多5个字符):

for(i=0;

n;

if(strlen(p->

id)>

6||strlen(p->

name)>

5)

printf("

\n职工工号或姓名输入长度不合法!

\n\n请按回车键返回主菜单\n"

n);

free(p);

getchar();

system("

return;

k++)/*时间初始化为88:

88*/

p->

\n%d条信息建立完毕!

getchar();

writeinfo_flag=1;

voidcreateRec()/*录入考勤信息*/

worker*p;

chars[10],k[10],*g=k,ss[10];

intc,m,week;

week=timeinfo->

tm_wday;

if(head==NULL)

\n\n\n\n\t\t\t数据库中没有职工信息\n\n\t\t\t无法使用该功能\n\n\t\t\t请按回车键返回主菜单新建职工信息!

tm_wday==6||timeinfo->

\n\n\n\n\t\t\t今天不是工作日\n\n\t\t\t无法录入考勤信息\n\n\t\t\t请按回车键返回主菜单!

\n\n\n\t\t\t请选择录入考勤种类:

\n\n\t\t\t1.上午上班(8:

00)\n\n\t\t\t2.上午下班(11:

30)\n\n\t\t\t3.下午上班(14:

00)\n\n\t\t\t4.下午下班(17:

30)\n\n"

\n\t\t您的选择(以回车键结束):

k);

if(fun(k)==0)

m=atoi(k);

if(m<

1||m>

4)

\n\n\t\t输入错误!

\n\n\t\t请按回车键返回主菜单重新开始!

return;

if(m==1&

(timeinfo->

tm_hour>

11||(timeinfo->

tm_hour==11&

timeinfo->

tm_min>

30)))

\n\n\n\t\t\t现在已经过了上午下班的时间(11:

30)\n\n\t\t\t无法录入上班的时间(8:

00)信息\n\n\t\t\t请按回车键返回主菜单"

if(m==3&

17||(timeinfo->

tm_hour==17&

\n\n\n\t\t\t现在已经过了下午下班的时间(17:

30)\n\n\t\t\t无法录入上班的时间(14:

/*可通过工号或姓名;

录入*/

\n\n\n\t\t\t请选择输入工号还是姓名:

\n\n\t\t\t1.选择输入工号\n\n\t\t\t2.选择输入姓名\n\n"

ss);

if(fun(ss)==0)

c=atoi(ss);

if(c<

1||c>

2)

switch(c)

case1:

\n\n\n\n\n\n\t\t\t请输入工号(以回车键结束):

scanf("

for(p=head;

strcmp(p->

id,s)!

=0&

=NULL;

p=p->

next);

if(strcmp(p->

next==NULL)

{

\n\n\n\n\t\t\t不存在该工号\n"

\n\n\n\n\t\t\t请按回车键返回主菜单重新开始!

return;

if((m==2||m==4)&

time[4*week+m-6].hour==88)

\n\n\n\n\t\t\t该职工无上班记录,无法记录下班信息,请先录入上班信息\n"

time[4*week+m-5].hour=(timeinfo->

tm_hour);

/*存储时间*/

time[4*week+m-5].minute=(timeinfo->

break;

case2:

\n\n\n\n\n\n\t\t\t请输入姓名(以回车键结束):

name,s)!

\n\n\n\n\t\t\t不存在该姓名\n"

time(&

timeinfo=localtime(&

week=timeinfo->

\n\n\n\n\n\n\t\t\t考勤成功!

请按回车键返回主菜单\n"

voidlistRec()/*浏览当天的考勤信息*/

intm,week;

\n\n\n\n\t\t\t今天不是工作日,无考勤记录\n\n\t\t\t无法浏览当天的考勤信息\n\n\t\t\t请按回车键返回主菜单!

\n职工今天整体出勤情况如下:

\n\n"

职工号姓名上午上班上午下班下午上班下午下班\n"

while(p!

m=0;

\n%s%s"

if((p->

time[(week-1)*4].hour>

8&

time[(week-1)*4].hour<

25)||(p->

time[(week-1)*4].hour==8&

time[(week-1)*4].minute>

0))

迟到"

/*上班时间之后来的都算迟到*/

elseif(p->

time[(week-1)*4].hour==88&

旷工"

/*过了下班时间就是旷工*/

tm_hour<

tm_hour==8&

tm_min==30)))

无记录"

/*下班之前还没有来显示无记录*/

time[(week-1)*4].hour!

=88)

{printf("

"

m++;

time[(week-1)*4+1].hour<

11&

=0)||(p->

time[(week-1)*4+1].hour==11&

time[(week-1)*4+1].minute<

30))

早退"

else{printf("

"

time[(week-1)*4+2].hour>

14&

time[(week-1)*4+2].hour<

time[(week-1)*4+2].hour==14&

time[(week-1)*4+2].minute>

迟到"

time[(week-1)*4+2].hour==88&

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

当前位置:首页 > 高等教育 > 文学

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

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