急求一份VC6.0人事管理系统源代码,能运行,C语言的(122265310@qq.com) 10

 我来答
手机用户26775
2011-06-25 · TA获得超过296个赞
知道答主
回答量:459
采纳率:33%
帮助的人:332万
展开全部
/* Note:Your choice is C IDE */
#include "stdio.h"
#include<graphics.h>
#include "conio.h"
#include<stdlib.h>
#include<string.h>

void main()
{void adm1(),adm2(),build(),huan(),borrow(),dele();
adm1();

}

void adm1()
{ FILE *fp,*p ;
char adp[20],password[20];
int i,n=0;
textbackground(2);
clrscr();
gotoxy(25,12);
fp=fopen("pass","r");
if(fp==NULL)
printf("input password:");
for(;;)
{

window(42,12,53,12);
textbackground(0);
clrscr();
gets(adp);
for(i=0;adp[i]!='\0';i++);
fgets(password,i+1,fp);
gotoxy(55,12);
if(strcmp(password,adp)==0)
else{ n++;
window(55,12,60,12);clrscr();gotoxy(55,12);cprintf("error");
for(i=0;i<30;i++) delay(8000);
if(n==2)
if(n==3)
exit(0);
}
}
fclose(fp);clrscr();

}
}
void adm2()
{ char a;
window(1,1,80,25);
clrscr();
for(;;)
{ clrscr();
gotoxy(30,8);printf("built a new user (B)");
gotoxy(30,10);printf("return book (R)");
gotoxy(30,12);printf("borrow books (J)");
gotoxy(30,14);printf("delete user (D)");
a=getch();
if(a=='b') build();
if(a=='r') huan();
if(a=='j') borrow();
if(a=='d') dele();
else continue;

}

}

void build()
{ FILE *f,*p;
char id[20],name[20],sex[2],age[3],grad[50];
window(1,1,80,25);
clrscr();
printf("ID number:");
scanf("%s",id);
printf("name:");
scanf("%s",name);
printf("sex:");
scanf("%s",sex);
printf("grad:");
scanf("%s",grad);
p=fopen(id,"w+");
if(p==NULL)

fprintf(p,"%s ",name);
fprintf(p,"%s ",id);
fprintf(p,"%s ",sex);
fprintf(p,"%s ",grad);
printf("bulid success");
getch();
fclose(p);
}

void huan()
{
FILE *fp,*p,*f;
char id[20],a[5][50],name[20],c;
int i=0,m,k; clrscr();
printf("input ID number:");
scanf("%s",id);
p=fopen(id,"r");
if(p==NULL)
fscanf(p,"%s",name);
fclose(p);
fp=fopen(name,"r");
dowhile(!feof(fp));

for(k=0;k<i-1;k++) printf("\nbook %d: %s",k+1,a[k]);
fclose(fp);
f=fopen(name,"w+");
for(;;)
{
printf("\n\npress the book number that you want to return. \n\nPress 6 if you want to return all. \n\npress 7 to cancle.\n");
scanf("%d",&m);
if(m==7) { for(k=0;k<i-1;k++)
{
fprintf(f,"%s\n",a[k]);
}
fclose(f);
adm2();
}
if(m==6) remove(name);
if(m<6)
for(k=0;k<i-1;k++)
{ if(k!=m-1)
fprintf(f,"%s\n",a[k]);
}
printf("book %d has returned.",m);
printf("\ncontinue? (Y/N)");
c=getch();
if(c=='y') continue;
if(c=='n')
}
}

void borrow()
{ FILE *f,*m,*p;
char id[20],book[5][50],name[20],c;
int i=0,n=0,k;
window(1,1,80,25);clrscr();
printf("please input the user's ID:");
scanf("%s",id);
m=fopen(id,"r");
if(m==NULL)
fscanf(m,"%s",name);
fclose(m);
p=fopen(name,"r");
if(p==NULL);
else
{ while(!feof(p))
{
fscanf(p,"%s",book[i]);
i++;
}
i--;
for(k=0;k<i;k++) printf("\nbook %d :%s",k+1,book[k]);
}
fclose(p);
f=fopen(name,"w");
printf("\nhow many book do you want to borrow?:");
dowhile(i+n>=6);
for(k=i;k<i+n;k++)
{ printf("\nbook %d :",k+1);
scanf("%s",book[k]);
}
for(k=0;k<i+n;k++) fprintf(f,"%s\n",book[k]);
fputc('\0',f);
printf("success");
fclose(f);

}

void dele()
{ FILE *fp,*f;
char id[20],a[4][20],c,b[5][50];
int i=0,j=0,k;
window(1,1,80,25);clrscr();
printf("Input ID number:");
scanf("%s",id);
fp=fopen(id,"r");
if(fp==NULL)
else while(!feof(fp))

printf("\nname: %s",a[0]);
printf("\nID: %s",a[1]);
printf("\nsex: %s",a[2]);
printf("\ngrad: %s",a[3]);
f=fopen(a[0],"r");
if(f==NULL);
else {
while(!feof(f))

for(k=0;k<j-1;k++) printf("\nbook %d: %s",k+1,b[k]);
}
printf("\nDo you want to delete? (Y/N): ");
c=getch();
fclose(fp);
fclose(f);
if(c=='y')
if(c=='n') adm2();
}
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式