|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#define NUM 1000
|
|
|
|
|
void enter();
|
|
|
|
|
void search_num();
|
|
|
|
|
void dele_num();
|
|
|
|
|
void modi_num();
|
|
|
|
|
void browse();
|
|
|
|
|
void count();
|
|
|
|
|
void add();
|
|
|
|
|
void menu();
|
|
|
|
|
int n; //Ա<><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
struct emploee //ְ<><D6B0><EFBFBD><EFBFBD><EFBFBD>ݽṹ
|
|
|
|
|
{
|
|
|
|
|
char no[5];
|
|
|
|
|
char name[8];
|
|
|
|
|
int wage1; //Ա<><D4B1><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int wage2; //Ա<><D4B1><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int funds; //Ա<><D4B1><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int ylbx; //Ա<><D4B1><EFBFBD><EFBFBD>ҽ<EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD>
|
|
|
|
|
int jt; //Ա<><D4B1><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
|
|
|
|
int wage3; //Ա<><D4B1><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int wage4; //ǰ3<C7B0><EFBFBD><EEB9A4>֮<EFBFBD><D6AE>
|
|
|
|
|
}emp[NUM],newemp;
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
menu();
|
|
|
|
|
}
|
|
|
|
|
void menu()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
int n;
|
|
|
|
|
do{
|
|
|
|
|
printf("**************** ְ<><D6B0><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>ϵͳ ***********\n");
|
|
|
|
|
printf("* 1-----<2D><><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>Ϣ------ *\n");
|
|
|
|
|
printf("* 2-----<2D><>ѯְ<D1AF><D6B0><EFBFBD><EFBFBD>Ϣ------ *\n");
|
|
|
|
|
printf("* 3-----ɾ<><C9BE>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>Ϣ------ *\n");
|
|
|
|
|
printf("* 4-----<2D><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>Ϣ------ *\n");
|
|
|
|
|
printf("* 5-----<2D><><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD>Ϣ------ *\n");
|
|
|
|
|
printf("* 6-----<2D><><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>Ϣ------ *\n");
|
|
|
|
|
printf("* 7-----<2D><><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>Ϣ------ *\n");
|
|
|
|
|
printf("* 8-------<2D>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>-------- *\n");
|
|
|
|
|
printf("*********************************************\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1-8<><38>:");
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
switch(n)
|
|
|
|
|
{
|
|
|
|
|
case 1:enter(); break;
|
|
|
|
|
case 2:search_num(); break;
|
|
|
|
|
case 3:dele_num(); break;
|
|
|
|
|
case 4:modi_num(); break;
|
|
|
|
|
case 5:count(); break;
|
|
|
|
|
case 6:browse(); break;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
case 7:add(); break;
|
|
|
|
|
case 8:printf("*******<2A><>ӭ<EFBFBD>´<EFBFBD>ʹ<EFBFBD>ã<EFBFBD>*******");
|
|
|
|
|
default:exit(0);//<2F>˳<EFBFBD>ϵͳ.exit(0)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}while(n!=0);
|
|
|
|
|
}
|
|
|
|
|
/*************************<2A><><EFBFBD><EFBFBD>**********************/
|
|
|
|
|
void enter()
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int n,i;
|
|
|
|
|
fp=fopen("emp.txt","ab+");
|
|
|
|
|
if(fp==NULL)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if ((fp=fopen("emp.txt","wb"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><EFBFBD><EFBFBD>emp<EFBFBD>ļ<EFBFBD>\n");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ְ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
for(i=0;i<n;i++) /* ѭ<><D1AD><EFBFBD><EFBFBD>ȡn<C8A1><6E>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>¼ */
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>%d<><64>ְ<EFBFBD><D6B0>:\n",i+1);
|
|
|
|
|
printf("ID:");
|
|
|
|
|
scanf("%s",emp[i].no);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",&emp[i].name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&emp[i].wage1);
|
|
|
|
|
printf("ְ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&emp[i].wage2);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&emp[i].jt);
|
|
|
|
|
printf("ҽ<EFBFBD>Ʊ<EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&emp[i].ylbx);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&emp[i].funds);
|
|
|
|
|
emp[i].wage3=emp[i].wage1+emp[i].wage2-emp[i].ylbx+emp[i].jt-emp[i].funds;
|
|
|
|
|
emp[i].wage4=emp[i].wage1+emp[i].wage2+emp[i].jt;
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<n;i++) /*<2A><>n<EFBFBD><6E>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>¼д<C2BC><D0B4><EFBFBD>ļ<EFBFBD>*/
|
|
|
|
|
fwrite(&emp[i],sizeof(struct emploee),1,fp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
/*************************ͳ<><CDB3><EFBFBD><EFBFBD>Ϣ**********************/
|
|
|
|
|
void count()
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int n,i;
|
|
|
|
|
int a=0,b=0,c=0;
|
|
|
|
|
if((fp=fopen("emp.txt","rb"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>emp<EFBFBD>ļ<EFBFBD>\n");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
for(n=0;fread(&emp[n],sizeof(struct emploee),1,fp)!=0;n++)
|
|
|
|
|
{
|
|
|
|
|
if(emp[n].wage4>=1000&&emp[i].wage4<2000)
|
|
|
|
|
{
|
|
|
|
|
a++;
|
|
|
|
|
}
|
|
|
|
|
if(emp[n].wage4>=2000&&emp[i].wage4<3000)
|
|
|
|
|
{
|
|
|
|
|
b++;
|
|
|
|
|
}
|
|
|
|
|
if(emp[n].wage4>=3000)
|
|
|
|
|
{
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1000~2000Ԫ<30><D4AA>ռ<EFBFBD>İٷ<C4B0>֮%d\n",a*100/n);
|
|
|
|
|
printf("ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD>2000~3000Ԫ<30><D4AA>ռ<EFBFBD>İٷ<C4B0>֮%d\n",b*100/n);
|
|
|
|
|
printf("ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD>3000Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>İٷ<EFBFBD>֮%d\n",c*100/n);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
/********************ɾ<><C9BE><EFBFBD><EFBFBD>Ϣ<EFBFBD>ĵط<C4B5>*******************/
|
|
|
|
|
void dele_num()
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int i,j,n;
|
|
|
|
|
char num[5];
|
|
|
|
|
if((fp=fopen("emp.txt","rb"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>emp<EFBFBD>ļ<EFBFBD>\n");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
printf("ID <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ְ<><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ҽ<>Ʊ<EFBFBD><C6B1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(n=0;fread(&emp[n],sizeof(struct emploee),1,fp);n++)
|
|
|
|
|
{
|
|
|
|
|
printf("ID:");
|
|
|
|
|
scanf("%-6s",emp[i].no);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-6s",&emp[i].name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-8d",&emp[i].wage1);
|
|
|
|
|
printf("ְ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-8d",&emp[i].wage2);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-8d",&emp[i].jt);
|
|
|
|
|
printf("ҽ<EFBFBD>Ʊ<EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-8d",&emp[i].ylbx);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-8d",&emp[i].funds);
|
|
|
|
|
printf("<EFBFBD>ܹ<EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-8d",&emp[i].wage3);
|
|
|
|
|
}/*nΪemp<6D>ļ<EFBFBD><C4BC>м<EFBFBD>¼<EFBFBD><C2BC>*/
|
|
|
|
|
printf("Ҫɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID:");
|
|
|
|
|
scanf("%s",num);
|
|
|
|
|
for(i=0;(strcmp(emp[i].no,num)!=0&&i<n);i++)
|
|
|
|
|
if(i>=n)
|
|
|
|
|
{
|
|
|
|
|
printf("\tû<EFBFBD><EFBFBD>%sְ<73><D6B0><EFBFBD>ŵ<EFBFBD>ְ<EFBFBD><D6B0>\n",num);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
fp=fopen("emp.dat","w+");
|
|
|
|
|
if(n==1) /*һ<><D2BB><EFBFBD><EFBFBD>¼<EFBFBD>Ѿ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>*/
|
|
|
|
|
{
|
|
|
|
|
fclose(fp);
|
|
|
|
|
exit(3);
|
|
|
|
|
}
|
|
|
|
|
for(j=0;j<i;j++)
|
|
|
|
|
fwrite(&emp[j],sizeof(struct emploee),1,fp);
|
|
|
|
|
for(j=i+1;j<n;j++)
|
|
|
|
|
fwrite(&emp[j],sizeof(struct emploee),1,fp);
|
|
|
|
|
printf("ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
fseek(fp,0,SEEK_SET);
|
|
|
|
|
for(i=0;fread(&emp[i],sizeof(struct emploee),1,fp);i++)
|
|
|
|
|
{
|
|
|
|
|
printf("ID:");
|
|
|
|
|
scanf("%-6s",emp[i].no);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-6s",&emp[i].name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-8d",&emp[i].wage1);
|
|
|
|
|
printf("ְ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-8d",&emp[i].wage2);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-8d",&emp[i].jt);
|
|
|
|
|
printf("ҽ<EFBFBD>Ʊ<EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-8d",&emp[i].ylbx);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-8d",&emp[i].funds);
|
|
|
|
|
printf("<EFBFBD>ܹ<EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%-8d",&emp[i].wage3);
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
/********************<2A><EFBFBD><DEB8><EFBFBD>Ϣ<EFBFBD>ĵط<C4B5>*******************/
|
|
|
|
|
void modi_num()
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int i,j;
|
|
|
|
|
char num[5];
|
|
|
|
|
if((fp=fopen("emp.txt","rb+"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>emp<6D>ļ<EFBFBD>\n");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
printf("Ҫ<EFBFBD>ĵ<EFBFBD>ID:");
|
|
|
|
|
scanf("%s",num);
|
|
|
|
|
for(i=0;fread(&emp[i],sizeof(struct emploee),1,fp);i++)
|
|
|
|
|
if(!strcmp(emp[i].no,num))break;
|
|
|
|
|
if(feof(fp))
|
|
|
|
|
{
|
|
|
|
|
printf("\tû<EFBFBD><EFBFBD>%sְ<73><D6B0><EFBFBD>ŵ<EFBFBD>ְ<EFBFBD><D6B0>\n",num);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
printf("ID <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ְ<><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ҽ<>Ʊ<EFBFBD><C6B1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf(" %-6s %-6s %-8d %-8d %-8d %-8d %-8d %-8d\n",emp[i].no,emp[i].name,emp[i].wage1,emp[i].wage2,emp[i].jt,emp[i].ylbx,emp[i].funds,emp[i].wage3);
|
|
|
|
|
printf("ID <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ְ<><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ҽ<>Ʊ<EFBFBD><C6B1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%s%s%d%d%d%d%d",newemp.no,newemp.name,&newemp.wage1,&newemp.wage2,&newemp.jt,&newemp.ylbx,&newemp.funds);//<2F><>ȡ<EFBFBD>µ<EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>¼
|
|
|
|
|
newemp.wage3=newemp.wage1+newemp.wage2+newemp.jt-newemp.ylbx-newemp.funds;
|
|
|
|
|
fseek(fp,-(long)sizeof(struct emploee),SEEK_CUR); //<2F>ļ<EFBFBD>ָ<EFBFBD><D6B8>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ĵļ<C4B5>¼<EFBFBD><C2BC>ͷ
|
|
|
|
|
fwrite(&newemp,sizeof(struct emploee),1,fp); //<2F><>newemp<6D><70><EFBFBD>ǵ<EFBFBD>ǰ<EFBFBD><C7B0>¼
|
|
|
|
|
printf(" <20>ĺ<DEB8>:\n");
|
|
|
|
|
fseek(fp,0,SEEK_SET); //<2F><>ʾ<EFBFBD>ĺ<DEB8><C4BA><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
printf("ID <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ְ<><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ҽ<>Ʊ<EFBFBD><C6B1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(i=0;fread(&emp[i],sizeof(struct emploee),1,fp)!=0;i++)
|
|
|
|
|
printf(" %-6s %-6s %-8d %-8d %-8d %-8d %-8d %-8d\n",emp[i].no,emp[i].name,emp[i].wage1,emp[i].wage2,emp[i].jt,emp[i].ylbx,emp[i].funds,emp[i].wage3);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
/*************************<2A><>ѯ<EFBFBD><D1AF>Ϣ<EFBFBD>ĵط<C4B5>***********************/
|
|
|
|
|
void search_num()
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int i,n;
|
|
|
|
|
char num[5];
|
|
|
|
|
if((fp=fopen("emp.txt","rb"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>emp<EFBFBD>ļ<EFBFBD>\n");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
printf("Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ְ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",num);
|
|
|
|
|
for(i=0;fread(&emp[i],sizeof(struct emploee),1,fp);i++)
|
|
|
|
|
if(!strcmp(emp[i].no,num)) break;
|
|
|
|
|
if(feof(fp))
|
|
|
|
|
{
|
|
|
|
|
printf("\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
printf("ְ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ְ<><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ҽ<>Ʊ<EFBFBD><C6B1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf(" %-6s %-6s %-8d %-8d %-8d %-8d %-8d %-8d\n",emp[i].no,emp[i].name,emp[i].wage1,emp[i].wage2,emp[i].jt,emp[i].ylbx,emp[i].funds,emp[i].wage3);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>밴1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>밴0\n");
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
switch(n)
|
|
|
|
|
{
|
|
|
|
|
case 1:search_num();break;
|
|
|
|
|
case 0:break;
|
|
|
|
|
default:break;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
/*******************<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ĵط<C4B5>********************/
|
|
|
|
|
void browse()
|
|
|
|
|
{ int i;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
if((fp=fopen("emp.txt","r"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>emp<EFBFBD>ļ<EFBFBD>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD> ְ<><D6B0><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ְ<><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ҽ<>Ʊ<EFBFBD><C6B1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(i=0;fread(&emp[i],sizeof(struct emploee),1,fp)!=0;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("%-6d %-6s %-6s %-8d %-8d %-8d %-8d %-8d %-8d\n",i+1,emp[i].no,emp[i].name,emp[i].wage1,emp[i].wage2,emp[i].jt,emp[i].ylbx,emp[i].funds,emp[i].wage3);
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
/******************<2A><EFBFBD><DEB8><EFBFBD>Ϣ<EFBFBD>ĵط<C4B5>*******************/
|
|
|
|
|
void add()
|
|
|
|
|
{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int n,i,t;
|
|
|
|
|
if((fp=fopen("emp.txt","ab+"))==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>emp<EFBFBD>ļ<EFBFBD>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
printf("Ҫ<EFBFBD>ӵ<EFBFBD>ְ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
for(i=0;i<n;i++) /* ѭ<><D1AD><EFBFBD><EFBFBD>ȡn<C8A1><6E>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>¼ */
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD>%d<><64>ְ<EFBFBD><D6B0>:\n",i+1);
|
|
|
|
|
printf("ID:");
|
|
|
|
|
scanf("%s",emp[i].no);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",&emp[i].name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&emp[i].wage1);
|
|
|
|
|
printf("ְ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&emp[i].wage2);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&emp[i].jt);
|
|
|
|
|
printf("ҽ<EFBFBD>Ʊ<EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&emp[i].ylbx);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&emp[i].funds);
|
|
|
|
|
emp[i].wage3=emp[i].wage1+emp[i].wage2-emp[i].ylbx+emp[i].jt-emp[i].funds;
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<n;i++) /*<2A><>n<EFBFBD><6E>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>¼д<C2BC><D0B4><EFBFBD>ļ<EFBFBD>*/
|
|
|
|
|
fwrite(&emp[i],sizeof(struct emploee),1,fp);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>밴1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>밴0\n");
|
|
|
|
|
scanf("%d",&t);
|
|
|
|
|
switch(t)
|
|
|
|
|
{
|
|
|
|
|
case 1:add();break;
|
|
|
|
|
case 0:break;
|
|
|
|
|
default:break;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|