|
|
|
|
#include<stdio.h>
|
|
|
|
|
#define N 50
|
|
|
|
|
struct worker
|
|
|
|
|
{
|
|
|
|
|
char id[50];
|
|
|
|
|
char name[20];
|
|
|
|
|
char sex[10];
|
|
|
|
|
char age[10];
|
|
|
|
|
char edu[20];
|
|
|
|
|
char salary[10];
|
|
|
|
|
char address[20];
|
|
|
|
|
char tel[20];
|
|
|
|
|
}worker[N];
|
|
|
|
|
void save(int n) //<2F><><EFBFBD>溯<EFBFBD><E6BAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>n<EFBFBD><6E><EFBFBD><EFBFBD>¼
|
|
|
|
|
{ FILE *fp;
|
|
|
|
|
int i;
|
|
|
|
|
if((fp=fopen("worker.txt","wb+"))==NULL) //<2F>Զ<EFBFBD><D4B6><EFBFBD>д<EFBFBD><D0B4>ʽΪ<CABD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
{ printf("\nCannot open file\n");
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
if(fwrite(&worker[i],sizeof(struct worker),1,fp)!=1)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
|
|
|
|
printf("file write error\n");
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
int load() //<2F><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>
|
|
|
|
|
{ FILE *fp;
|
|
|
|
|
int i;
|
|
|
|
|
if((fp=fopen("worker.txt","rb"))==NULL)
|
|
|
|
|
{printf("\nCannot open file\n");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
for(i=0;!feof(fp);i++)
|
|
|
|
|
fread(&worker[i],sizeof(struct worker),1,fp);//<2F><><EFBFBD>ļ<EFBFBD><C4BC>ж<EFBFBD>ȡ<EFBFBD><C8A1>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
fclose(fp);
|
|
|
|
|
return(i-1);
|
|
|
|
|
}
|
|
|
|
|
void no_input(int i,int n) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뺯<EFBFBD><EBBAAF><EFBFBD><EFBFBD>i<EFBFBD><69>ʾ<EFBFBD><CABE>i<EFBFBD><69>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>n<EFBFBD><6E>ʾ<EFBFBD>Ƚϵ<C8BD><CFB5><EFBFBD>n<EFBFBD><6E>ְ<EFBFBD><D6B0>
|
|
|
|
|
{ int j,k,w1;
|
|
|
|
|
do
|
|
|
|
|
{w1=0;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
scanf("%s",worker[i].id);
|
|
|
|
|
for(j=0;worker[i].id[j]!='\0';j++)
|
|
|
|
|
if(worker[i].id[j]<'0'||worker[i].id[j]>'9') //<2F>жϹ<D0B6><CFB9><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
|
|
|
|
|
{puts("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
w1=1;break;
|
|
|
|
|
}
|
|
|
|
|
if(w1!=1)
|
|
|
|
|
for(k=0;k<n;k++) //<2F>Ƚϵ<C8BD><CFB5><EFBFBD>N<EFBFBD><4E>ְ<EFBFBD><D6B0>
|
|
|
|
|
if(k!=i&&strcmp(worker[k].id,worker[i].id)==0) //<2F>ж<EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|
|
|
|
{puts("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룡\n");
|
|
|
|
|
w1=1;break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while(w1==1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void input(int i) //<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>¼<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>
|
|
|
|
|
{ no_input(i,i); //<2F><><EFBFBD>빤<EFBFBD>ź<EFBFBD><C5BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");scanf("%s",worker[i].name);
|
|
|
|
|
printf("<EFBFBD>Ա<EFBFBD>:");scanf(" %s",&worker[i].sex);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");scanf("%s",&worker[i].age);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");scanf("%s",worker[i].salary);
|
|
|
|
|
printf("ѧ<EFBFBD><EFBFBD>:");scanf("%s",&worker[i].edu);
|
|
|
|
|
printf("סַ:");scanf("%s",worker[i].address);
|
|
|
|
|
printf("<EFBFBD>绰:");scanf("%s",worker[i].tel);
|
|
|
|
|
}
|
|
|
|
|
void printf_one(int i) //<2F><>ʾһ<CABE><D2BB><EFBFBD><EFBFBD>¼<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
printf("%10s %10s %5s %5s %8s %6s %10s %10s\n",
|
|
|
|
|
worker[i].id,worker[i].name,worker[i].sex,worker[i].age,
|
|
|
|
|
worker[i].salary,worker[i].edu,worker[i].address,worker[i].tel);
|
|
|
|
|
}
|
|
|
|
|
void printf_back() //һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>Ǻ<EFBFBD><C7BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>
|
|
|
|
|
{ int k,w;
|
|
|
|
|
printf("\n\n\tSuccessful^-^.\n\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʲô?\n\n\t1).<2E><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>\t2).<2E><><EFBFBD><EFBFBD>: [ ]\b\b");
|
|
|
|
|
scanf("%d",&w);
|
|
|
|
|
if(w==1)browse();
|
|
|
|
|
else menu();
|
|
|
|
|
}
|
|
|
|
|
modify_data(int i,int n) //<2F>ĺ<DEB8><C4BA><EFBFBD>
|
|
|
|
|
{ int c,w1;
|
|
|
|
|
do
|
|
|
|
|
{puts("\nmodify by=>\n\n 1).<2E><><EFBFBD><EFBFBD> 2).<2E><><EFBFBD><EFBFBD> 3).<2E>Ա<EFBFBD> 4).<2E><><EFBFBD><EFBFBD> 5).<2E><><EFBFBD><EFBFBD> 6).ѧ<><D1A7> 7).<2E><>ַ 8).<2E>绰 9).ȡ<><C8A1>");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>?:[ ]\b\b");
|
|
|
|
|
scanf("%d",&c);
|
|
|
|
|
if(c>9||c<1)
|
|
|
|
|
{
|
|
|
|
|
puts("\nChoice error!please again!");
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while(c>9||c<1);
|
|
|
|
|
do
|
|
|
|
|
{switch(c) //ͨ<><CDA8>switch<63>ṹѡ<E1B9B9><D1A1>Ҫ<EFBFBD>ĵ<DEB8><C4B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{case 1:no_input(i,n);break;
|
|
|
|
|
case 2:printf("name:");scanf("%s",worker[i].name);break;
|
|
|
|
|
case 3:printf("sex:");scanf("%s",worker[i].sex);break;
|
|
|
|
|
case 4:printf("age:");scanf("%s",worker[i].age);break;
|
|
|
|
|
case 5:printf("salary:");scanf("%s",worker[i].salary);break;
|
|
|
|
|
case 6:printf("edu:");scanf("%s",worker[i].edu);break;
|
|
|
|
|
case 7:printf("address:");scanf("%s",worker[i].address);break;
|
|
|
|
|
case 8:printf("tel:");scanf("%s",worker[i].tel);break;
|
|
|
|
|
case 9:menu();break;
|
|
|
|
|
}
|
|
|
|
|
puts("\nNow:\n");
|
|
|
|
|
printf_face();
|
|
|
|
|
printf_one(i);
|
|
|
|
|
printf("\nȷ<EFBFBD><EFBFBD>?\n\n\t1).<2E><> 2).<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3).<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD> [ ]\b\b");
|
|
|
|
|
scanf("%d",&w1);
|
|
|
|
|
if(w1==1)save(n);
|
|
|
|
|
}
|
|
|
|
|
while(w1==2);
|
|
|
|
|
return(w1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf_face() //<2F><>ʾ<EFBFBD><CABE><EFBFBD>ݽṹ<DDBD><E1B9B9>Ŀ
|
|
|
|
|
{ printf("\n\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ա<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ѧ<><D1A7> <20><>ַ <20>绰<EFBFBD><E7BBB0><EFBFBD><EFBFBD>\n"); }
|
|
|
|
|
|
|
|
|
|
void enter() //<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
|
|
{ int i,n;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٸ<EFBFBD>ְ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ(0-%d):",N-1);
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>Ϣ\n\n");
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
input(i); //<2F><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵĺ<DDB5><C4BA><EFBFBD>
|
|
|
|
|
if(i!=0)
|
|
|
|
|
save(n); //<2F><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>ĺ<EFBFBD><C4BA><EFBFBD>
|
|
|
|
|
printf_back();
|
|
|
|
|
}
|
|
|
|
|
browse() //<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
|
|
{ int i,j,n;
|
|
|
|
|
n=load();
|
|
|
|
|
printf_face();
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
{
|
|
|
|
|
if((i!=0)&&(i%10==0))
|
|
|
|
|
{printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>һҳ...");
|
|
|
|
|
getch();
|
|
|
|
|
puts("\n\n");
|
|
|
|
|
}
|
|
|
|
|
printf_one(i);
|
|
|
|
|
}
|
|
|
|
|
printf("\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD>¼.\n",n);
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
|
|
|
|
|
getch();
|
|
|
|
|
menu();
|
|
|
|
|
}
|
|
|
|
|
modify() //<2F><EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
|
|
{
|
|
|
|
|
struct worker s;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int i,n,k,w0=1,w1,w2=0;
|
|
|
|
|
n=load();
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
k=-1;
|
|
|
|
|
printf_face();
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
{
|
|
|
|
|
if((i!=0)&&(i%10==0)) //Ŀ<><C4BF><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
{printf("\n\n<EFBFBD><EFBFBD>סҪ<EFBFBD>ĵĹ<EFBFBD><EFBFBD><EFBFBD>.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>һҳ");
|
|
|
|
|
getch();
|
|
|
|
|
puts("\n\n");
|
|
|
|
|
}
|
|
|
|
|
printf_one(i); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾһ<CABE><D2BB><EFBFBD><EFBFBD>¼<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD>ְ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>! <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",s.id); //<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<DEB8>ID
|
|
|
|
|
for(i=0;i<n;i++) //<2F><><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<DEB8><C4B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if(strcmp(s.id,worker[i].id)==0)
|
|
|
|
|
{
|
|
|
|
|
k=i; //<2F>ҵ<EFBFBD>Ҫ<EFBFBD>ĵļ<C4B5>¼
|
|
|
|
|
s=worker[i]; //<2F><>worker[i]<5D><><EFBFBD>ݣ<EFBFBD><DDA3>Ա<EFBFBD><D4B1>ָ<EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
if(k==-1)
|
|
|
|
|
printf("\n\nδ<EFBFBD>ҵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
while(k==-1); //<2F><>k=-1<><31>ʾû<CABE><C3BB><EFBFBD>ҵ<EFBFBD>
|
|
|
|
|
printf_face(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ݽṹ<DDBD><E1B9B9>Ŀ<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>
|
|
|
|
|
printf_one(k); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾһ<CABE><D2BB><EFBFBD><EFBFBD>¼<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>
|
|
|
|
|
w1=modify_data(k,n); //<2F>ļ<DEB8>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵw1<77><31>w1=1<><31>ʾ<EFBFBD>û<EFBFBD><C3BB><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>
|
|
|
|
|
if(w1==1)
|
|
|
|
|
{
|
|
|
|
|
printf("\Successful^_^.\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\n\t1).<2E><> 2).<2E><EFBFBD><F1A3ACB1><EFBFBD><EFBFBD>˳<EFBFBD>\t[ ]\b\b");
|
|
|
|
|
scanf("%d",&w0);
|
|
|
|
|
w2=1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD><C6B1>棬ʹw2=1<>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
w0=0;
|
|
|
|
|
if(w2==1)
|
|
|
|
|
worker[k]=s;
|
|
|
|
|
}
|
|
|
|
|
if(w0!=1&&w2==1)
|
|
|
|
|
save(n);
|
|
|
|
|
}while(w0==1);
|
|
|
|
|
menu();
|
|
|
|
|
}
|
|
|
|
|
search() //<2F><>ѯģ<D1AF><C4A3>
|
|
|
|
|
{ int c,w1;
|
|
|
|
|
do
|
|
|
|
|
{puts("\nsearch by=>\n\n1).<2E><><EFBFBD><EFBFBD> 2}.ѧ<><D1A7> 3).ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
printf("Which you needed?:[ ]\b\b");
|
|
|
|
|
scanf("%d",&c);
|
|
|
|
|
if(c>3||c<1)
|
|
|
|
|
{ puts("\nchoice error!please again!");
|
|
|
|
|
getchar();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while(c>3||c<1);
|
|
|
|
|
{switch(c)
|
|
|
|
|
{case 1:search1();break;
|
|
|
|
|
case 2:search2();break;
|
|
|
|
|
case 3:menu();break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
search1() //<2F><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD>ѯģ<D1AF><C4A3>
|
|
|
|
|
{int i,n,k,w1=1,w2,w3,w4;
|
|
|
|
|
struct worker s;
|
|
|
|
|
n=load();
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
do
|
|
|
|
|
{k=-1;
|
|
|
|
|
printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD>Ĺ<EFBFBD><EFBFBD><EFBFBD>! id:");
|
|
|
|
|
scanf("%s",s.id);
|
|
|
|
|
printf_face();
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
if(strcmp(s.id,worker[i].id)==0)
|
|
|
|
|
{k=i;
|
|
|
|
|
printf_one(k);break;
|
|
|
|
|
}
|
|
|
|
|
if(k==-1)
|
|
|
|
|
{printf("\n\nNo exit!please");
|
|
|
|
|
printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?\n\t1).<2E><> 2).<2E><EFBFBD><F1A3ACB7><EFBFBD> [ ]\b\b");
|
|
|
|
|
scanf("%d",&w1);
|
|
|
|
|
if(w1==2) menu();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while(k==-1&&w1==1);
|
|
|
|
|
w4=0;w3=0;
|
|
|
|
|
if(k!=-1)
|
|
|
|
|
{printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʲô?\n\t1).<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> 2).<2E><EFBFBD> 3).<2E><><EFBFBD>ز˵<D8B2> [ ]\b\b");
|
|
|
|
|
scanf("%d",&w2);
|
|
|
|
|
switch(w2)
|
|
|
|
|
{
|
|
|
|
|
case 1:search1();break;
|
|
|
|
|
case 2:w3=modify_data(k,n);break;
|
|
|
|
|
case 3:{menu();break;}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while(w2==1);
|
|
|
|
|
menu();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
search2() //<2F><>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>ѯģ<D1AF><C4A3>
|
|
|
|
|
{
|
|
|
|
|
int i,n,k,w1=1,w2,w3,w4;
|
|
|
|
|
struct worker s;
|
|
|
|
|
n=load();
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
do
|
|
|
|
|
{k=-1;
|
|
|
|
|
printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%s",s.edu);
|
|
|
|
|
printf_face();
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
if(strcmp(s.edu,worker[i].edu)==0) //<2F><><EFBFBD><EFBFBD>strcmp<6D><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><D3B6>ҵ<EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0>
|
|
|
|
|
{k=i;
|
|
|
|
|
printf_one(k);
|
|
|
|
|
}
|
|
|
|
|
if(k==-1)
|
|
|
|
|
{printf("\n\nNo exit!please");
|
|
|
|
|
printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?\n\t1).<2E><> 2).<2E><EFBFBD><F1A3ACB7><EFBFBD> [ ]\b\b");
|
|
|
|
|
scanf("%d",&w1);
|
|
|
|
|
if(w1==2) menu();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while(k==-1&&w1==1);
|
|
|
|
|
w4=0;w3=0;
|
|
|
|
|
if(k!=-1)
|
|
|
|
|
{printf("\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʲô?\n\t1).<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> 2).<2E><EFBFBD> 3).<2E><><EFBFBD>ز˵<D8B2> [ ]\b\b");
|
|
|
|
|
scanf("%d",&w2);
|
|
|
|
|
switch(w2)
|
|
|
|
|
{case 1:search2();break;
|
|
|
|
|
case 2:w3=modify_data(k,n);break;
|
|
|
|
|
case 3:{menu();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while(w2==1);
|
|
|
|
|
menu();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
menu()
|
|
|
|
|
{
|
|
|
|
|
int n,w1;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
puts("\t\t*******************<2A>˵<EFBFBD>*******************\n\n");
|
|
|
|
|
puts("\t\t\t\t1.¼<><C2BC>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
puts("\t\t\t\t2.<2E><><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
puts("\t\t\t\t3.<2E><>ѯְ<D1AF><D6B0><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
puts("\t\t\t\t4.<2E><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD>Ϣ");
|
|
|
|
|
puts("\t\t\t\t5.<2E>˳<EFBFBD>");
|
|
|
|
|
puts("\t\t****************************************\n\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>(1~5): [ ]\b\b");
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
if(n<1||n>5) //<2F><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|
|
|
|
{w1=1;getchar();}
|
|
|
|
|
else w1=0;
|
|
|
|
|
} while(w1==1);
|
|
|
|
|
switch(n)
|
|
|
|
|
{case 1:enter();break; //¼<><C2BC>
|
|
|
|
|
case 2:browse();break; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
case 3:search();break; //<2F><>ѯ
|
|
|
|
|
case 4:modify();break; //<2F><EFBFBD>
|
|
|
|
|
case 5:exit(0); //<2F>˳<EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
main()
|
|
|
|
|
{
|
|
|
|
|
menu();
|
|
|
|
|
}
|