请假管理系统源代码.docx

上传人:b****2 文档编号:762982 上传时间:2022-10-12 格式:DOCX 页数:20 大小:42.49KB
下载 相关 举报
请假管理系统源代码.docx_第1页
第1页 / 共20页
请假管理系统源代码.docx_第2页
第2页 / 共20页
请假管理系统源代码.docx_第3页
第3页 / 共20页
请假管理系统源代码.docx_第4页
第4页 / 共20页
请假管理系统源代码.docx_第5页
第5页 / 共20页
点击查看更多>>
下载资源
资源描述

请假管理系统源代码.docx

《请假管理系统源代码.docx》由会员分享,可在线阅读,更多相关《请假管理系统源代码.docx(20页珍藏版)》请在冰豆网上搜索。

请假管理系统源代码.docx

请假管理系统源代码

#include

#include

#include

#include

#defineselectint

typedefstruct//账户信息{

charname[20];//User.name

charpw[20];//User.pw

}User;

typedefstruct

{

charNum[20];

charn1[20];

charClass[20];

chartime[100];

charreason[100];

charinstructor[100];

}Leave;

typedefstruct

{

charn1[20];

charNum[20];

//charname[20];

charClass[20];

chartime[100];

charreason[100];

charinstructor[100];

charsuggest[100];

}TEACHER;

intcheck(charname[20])

{

inti=0;

Userru;

FILE*f=fopen("data.dat","rb");rewind(f);

for(i=0;!

feof(f);i++)

{

intd=i*sizeof(User);fseek(f,d,SEEK_SET);fread(&ru,sizeof(User),1,f);

if(strcmp(name,ru.name)==0)return1;

}

return-1;}

intlogin(charname[20],charpw[20])

{

Userus;

FILE*f=fopen("data.dat","rb");while(!

feof(f))

{fread(&us,sizeof(User),1,f);

if(strcmp(name,us.name)==0)

{

if(strcmp(pw,us.pw)==0)return1;

}

}

return-1;

}

intmain()

{

charn[20];

charplog[20];

charnlog[20];

intc;

Useru;

FILE*f=fopen("data.dat","ab");if(f!

=NULL)

{

fwrite(&u,sizeof(User),1,f);

fclose(f);

Login:

system("colorF0");system("cls");printf("\n\n");

printf("===========================================

=============================\n");

printf("|

|\n");

|\n");

printf("|学生请假系统

printf("|

|\n");

printf("========================================================================\n");

printf("\n");

Sleep(1000);printf("\n");printf("请输入帐号:

");scanf("%s",nlog);c=check(nlog);if(c==1)//如果账户存在{

strcpy(n,nlog);//复制登录帐号if(strlen(n)==9)//如果是学生{inta,i;selects=0;printf("\n");printf("请输入密码:

");//直接输入密码scanf("%s",plog);

for(a=2,i=0;i<4;i++,a--){

if(login(nlog,plog)==-1)//密码错误{

登录数组初始化

密码错误!

system("colorF0");charplog[20]={};//system("cls");

printf("\n");

n");

printf("*

*\n");

printf("\n\n");

if(a>0)

{

printf("请重新输入密码(你还有%d次机会):

",a);

printf("\n\n");

scanf("%s",plog);

if(login(nlog,plog)==1)

gotosuccess2;

}

else

return0;

}

}

if(login(nlog,plog)==1)

{

success2:

system("colorF0");

printf("\n\n");

printf("登陆成功///////////////////////\n");

Sleep(1000);

system("cls");

}

LEAVESYSTEM:

printf("\n\n");

printf("===========================================

=============================\n");

printf("|1.

提交

假申

|\n");

printf("|2.

查询请

批准状

|\n");

|\n");

printf("========================================================================\n");

printf("\n\n");

Sleep(1000);

printf("请输入您要执行的选项:

");

scanf("%d",&s);

Sleep(1000);while(s!

=1&&s!

=2)

{if(s!

=1&&s!

=2)

{system("color0c");printf("选项不存在,请重新输入(1/2):

");s=0;

scanf("%d",&s);

}

}

if(s==1)//写入请假

{system("colorF0");system("cls");printf("\n\n");

printf("========================================================================\n");

printf("|

|\n");

printf("|提交请假申请|\n");

printf("|

|\n");

printf("========================================================================\n");

printf("\n\n");

Leavea;

Sleep(1000);

printf("请输入班级:

\n");

scanf("%s",a.Class);

printf("请输入姓名:

\n");

scanf("%s",a.n1);

printf("请详细输入请假时间:

\n");scanf("%s",a.time);

printf("请详细输入请假原因:

\n");scanf("%s",a.reason);

strcpy(nlog,a.Num);

strcpy(a.instructor,"0");FILE*t=fopen("leave.dat","ab");

fwrite(&a,sizeof(Leave),1,t);//讲以变量u的地址开始的存区域的一个数据写到f指向的文件中,每个数据占sizeof(User)

fclose(t);

fflush(t);

//Sleep(1000);

printf("\n");

printf("保存成功///////////////////////\n");

printf("请不定时来查询你的假条申请状态!

\n\n\n");

system("pause");

system("cls");

gotoLEAVESYSTEM;

}

if(s==2)//学生查询状态代码

{

system("colorF0");

system("cls");

printf("\n\n");

printf("========================================================================\n");

printf("|

|\n");

printf("|查询请假批准状态|\n");

printf("|

|\n");

printf("========================================================================\n");

Sleep(1000);

TEACHERb;

FILE*t=fopen("read.dat","rb");

while

(1)

{

if(!

(fread(&b,sizeof(TEACHER),1,t)))break;

if((strcmp(nlog,b.Num))==0)

{

printf("

printf("|

学生%s

假申

\n");

请反馈信

息:

\n",b.n1);

printf("|

%s\n

\n",b.Class);

printf("|

%s\n

\n",b.n1);

printf("|

间:

%s\n

\n",b.time);

printf("|

因:

%s\n

\n",b.reason);

printf("\n");

Sleep(1000);

printf("\n");

printf("

\n")

printf("申请状态:

%s\n",b.instructor);

printf("辅导员意见:

%s\n",b.suggest);

printf("

\n")

system("pause");

Sleep(1000);

system("cls");

gotoLEAVESYSTEM;

}

}

}

if(s==3)

{

gotoLogin;

}

}//身份学生

if(strlen(n)==4)//如果是辅导员

{

inta,i;selects;printf("\n");

printf("请输入密码:

");//直接输入密码

scanf("%s",plog);

for(a=2,i=0;i<4;i++,a--)

{

if(login(nlog,plog)==-1)//{

system("color0c");charplog[20]={};//system("cls");printf("\n");

密码错误

登录数组初始化

n");

printf("*

*\n");

密码错误!

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

当前位置:首页 > 幼儿教育 > 幼儿读物

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

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