《请假管理系统源代码》由会员分享,可在线阅读,更多相关《请假管理系统源代码(28页珍藏版)》请在金锄头文库上搜索。
1、 #include #include #include #include #define select inttypedef struct /账户信息 char name20; /User.name char pw20; /User.pw User;typedef struct char Num20; char n120; char Class20; char time100; char reason100; char instructor100; Leave;typedef struct char n120; char Num20;/ char name20; char Class20; c
2、har time100; char reason100; char instructor100;char suggest100; TEACHER;int check (char name20) int i=0; User ru; FILE *f =fopen(data.dat,rb); rewind(f); for(i=0; !feof(f); i+) int d=i*sizeof(User); fseek(f,d,SEEK_SET); fread(&ru,sizeof(User),1,f); if(strcmp(name,ru.name)=0) return 1; return -1;int
3、 login(char name20,char pw20) User us; 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)return 1; return -1;int main() char n20; char plog20; char nlog20; int c; User u; FILE *f =fopen(data.dat,ab); if(f!=NULL) fwrite(&u,sizeof
4、(User),1,f); fclose(f);Login: system(color F0); system(cls); printf(nn); printf(=n); printf(| |n); printf(|-学生请假系统-|n); 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)/如果是学生 int a,i; select
5、s=0; printf(n); printf(请输入密码:);/直接输入密码 scanf(%s,plog); for(a=2,i=0; i0) printf(请重新输入密码(你还有%d次机会):,a); printf(nn); scanf(%s,plog); if(login(nlog,plog)=1) goto success2; else return 0; if(login(nlog,plog)=1) success2: system(color F0); printf(nn); printf( 登陆成功/n); Sleep(1000); system(cls); LEAVESYSTEM
6、: printf(nn); printf(=n); printf(|1.提交请假申请 |n); printf(|2.查询请假批准状态 |n); printf(| 如无需操作,可直接关闭程序 |n); printf(=n); printf(nn); Sleep(1000); printf(请输入您要执行的选项:); scanf(%d,&s); Sleep(1000); while(s!=1&s!=2) if(s!=1&s!=2) system(color 0c); printf(选项不存在,请重新输入(1/2):); s=0; scanf(%d,&s); if(s=1)/写入请假 system(color F0); system(cls); printf(nn); printf(=n); printf(| |n);