|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
char name[10];
|
|
|
|
|
char jiguan[20];
|
|
|
|
|
long long num1;
|
|
|
|
|
long long num2;
|
|
|
|
|
char email[20];
|
|
|
|
|
}person;
|
|
|
|
|
void xinjian(FILE *p);
|
|
|
|
|
void liulan(FILE *p);
|
|
|
|
|
void chaxun(FILE *p);
|
|
|
|
|
void xiugai(FILE *p);
|
|
|
|
|
int shanchu(FILE *p);
|
|
|
|
|
int count=0;
|
|
|
|
|
FILE *p;
|
|
|
|
|
person lxr;
|
|
|
|
|
void main()
|
|
|
|
|
{
|
|
|
|
|
char next='Y';
|
|
|
|
|
char ch;
|
|
|
|
|
int b;
|
|
|
|
|
while(next=='Y')
|
|
|
|
|
{
|
|
|
|
|
printf("---------<2D><>ӭʹ<D3AD><CAB9>ѶͨѶ¼---------\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("1:<3A>½<EFBFBD><C2BD><EFBFBD>ϵ<EFBFBD><CFB5>\n");
|
|
|
|
|
printf("2:<3A>鿴<EFBFBD><E9BFB4>ϵ<EFBFBD><CFB5>\n");
|
|
|
|
|
printf("3:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>\n");
|
|
|
|
|
printf("4:<3A><EFBFBD><DEB8><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>Ϣ\n");
|
|
|
|
|
printf("5:ɾ<><C9BE><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>\n");
|
|
|
|
|
printf("6:<3A>˳<EFBFBD>ͨѶ¼\n");
|
|
|
|
|
int c;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>");
|
|
|
|
|
scanf("%d",&c);
|
|
|
|
|
switch(c)
|
|
|
|
|
{
|
|
|
|
|
case 1:xinjian(p);
|
|
|
|
|
break;
|
|
|
|
|
case 2:liulan(p);
|
|
|
|
|
break;
|
|
|
|
|
case 3:chaxun(p);
|
|
|
|
|
break;
|
|
|
|
|
case 4:xiugai(p);
|
|
|
|
|
break;
|
|
|
|
|
case 5:b=shanchu(p);
|
|
|
|
|
break;
|
|
|
|
|
case 6:printf("<EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>!");
|
|
|
|
|
break;
|
|
|
|
|
default:printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(c==6)
|
|
|
|
|
next='N';
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:Y\n<EFBFBD>˳<EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ\n");
|
|
|
|
|
if(c==5)
|
|
|
|
|
scanf("%c",&next);
|
|
|
|
|
else
|
|
|
|
|
scanf("%c%c",&ch,&next);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void xinjian(FILE *p)
|
|
|
|
|
{
|
|
|
|
|
char next='Y';
|
|
|
|
|
p=fopen("txl.sto","rb+");
|
|
|
|
|
if(p==NULL)
|
|
|
|
|
p=fopen("txl.sto","wb+");
|
|
|
|
|
fseek(p,0,SEEK_END);
|
|
|
|
|
while(next=='Y')
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
scanf("%s",lxr.name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
scanf("%s",lxr.jiguan);
|
|
|
|
|
printf("<EFBFBD>绰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1:\n");
|
|
|
|
|
scanf("%lld",&lxr.num1);
|
|
|
|
|
printf("<EFBFBD>绰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>2:\n");
|
|
|
|
|
scanf("%lld",&lxr.num2);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
scanf("%s",lxr.email);
|
|
|
|
|
fwrite(&lxr,sizeof(lxr),1,p);
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>ˣ<EFBFBD>\n<EFBFBD><EFBFBD>:Y\n<EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ\n");
|
|
|
|
|
next=getchar();
|
|
|
|
|
count=count+1;
|
|
|
|
|
}
|
|
|
|
|
fclose(p);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void liulan(FILE *p)
|
|
|
|
|
{ int i=0;
|
|
|
|
|
p=fopen("txl.sto","rb+");
|
|
|
|
|
if(p==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("ͨѶ¼Ϊ<EFBFBD>գ<EFBFBD><EFBFBD>뽨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
fclose(p);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rewind(p);
|
|
|
|
|
printf("\n\nItem list-------------------------------------1\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>绰<EFBFBD><E7BBB0><EFBFBD><EFBFBD>1 <20>绰<EFBFBD><E7BBB0><EFBFBD><EFBFBD>2 <20><><EFBFBD><EFBFBD>\n");
|
|
|
|
|
fread(&lxr,sizeof(lxr),1,p);
|
|
|
|
|
while(!feof(p))
|
|
|
|
|
{
|
|
|
|
|
printf("%s %s %lld %lld %s\n",lxr.name,lxr.jiguan,lxr.num1,lxr.num2,lxr.email);
|
|
|
|
|
fread(&lxr,sizeof(lxr),1,p);
|
|
|
|
|
}
|
|
|
|
|
fclose(p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void chaxun(FILE *p)
|
|
|
|
|
{
|
|
|
|
|
int xuhao1=0;
|
|
|
|
|
p=fopen("txl.sto","rb+");
|
|
|
|
|
if(p==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("ͨѶ¼Ϊ<EFBFBD>գ<EFBFBD><EFBFBD>뽨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
fclose(p);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
char mingzi[20];
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
scanf("%s",mingzi);
|
|
|
|
|
fread(&lxr,sizeof(lxr),1,p);
|
|
|
|
|
while(!feof(p))
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(mingzi,lxr.name)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: <20>绰<EFBFBD><E7BBB0><EFBFBD><EFBFBD>1: <20>绰<EFBFBD><E7BBB0><EFBFBD><EFBFBD>2: <20><><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
printf("%s %s %lld %lld %s\n",lxr.name,lxr.jiguan,lxr.num1,lxr.num2,lxr.email);
|
|
|
|
|
xuhao1=xuhao1+1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fread(&lxr,sizeof(lxr),1,p);
|
|
|
|
|
}
|
|
|
|
|
if(xuhao1==count&&(strcmp(mingzi,lxr.name)!=0))
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
fclose(p);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void xiugai(FILE *p)
|
|
|
|
|
{
|
|
|
|
|
rewind(p);
|
|
|
|
|
p=fopen("txl.sto","rb+");
|
|
|
|
|
if(p==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("ͨѶ¼Ϊ<EFBFBD>գ<EFBFBD><EFBFBD>뽨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
fclose(p);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
char mingzi[20];
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>:\n");
|
|
|
|
|
scanf("%s",mingzi);
|
|
|
|
|
while(!feof(p))
|
|
|
|
|
{
|
|
|
|
|
fread(&lxr,sizeof(lxr),1,p);
|
|
|
|
|
if(strcmp(mingzi,lxr.name)==0)
|
|
|
|
|
{
|
|
|
|
|
char next='Y';
|
|
|
|
|
printf("1.<2E><><EFBFBD><EFBFBD>:%s\n",lxr.name);
|
|
|
|
|
printf("2.<2E><><EFBFBD><EFBFBD>:%s\n",lxr.jiguan);
|
|
|
|
|
printf("3.<2E>绰<EFBFBD><E7BBB0><EFBFBD><EFBFBD>1:%lld\n",lxr.num1);
|
|
|
|
|
printf("4.<2E>绰<EFBFBD><E7BBB0><EFBFBD><EFBFBD>2:%lld\n",lxr.num2);
|
|
|
|
|
printf("5.<2E><><EFBFBD><EFBFBD>:%s\n",lxr.email);
|
|
|
|
|
printf("6.ȡ<><C8A1>\n");
|
|
|
|
|
while(next=='Y')
|
|
|
|
|
{
|
|
|
|
|
int xuhao;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&xuhao);
|
|
|
|
|
switch(xuhao)
|
|
|
|
|
{
|
|
|
|
|
case 1:printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",lxr.name);
|
|
|
|
|
break;
|
|
|
|
|
case 2:printf("<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",lxr.jiguan);
|
|
|
|
|
break;
|
|
|
|
|
case 3:printf("<EFBFBD><EFBFBD><EFBFBD>ĵ绰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1:");
|
|
|
|
|
scanf("%lld",&lxr.num1);
|
|
|
|
|
break;
|
|
|
|
|
case 4:printf("<EFBFBD><EFBFBD><EFBFBD>ĵ绰<EFBFBD><EFBFBD><EFBFBD><EFBFBD>2:");
|
|
|
|
|
scanf("%lld",&lxr.num2);
|
|
|
|
|
break;
|
|
|
|
|
case 5:printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%s",lxr.email);
|
|
|
|
|
break;
|
|
|
|
|
case 6:break;
|
|
|
|
|
|
|
|
|
|
default:printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:Y\nֹͣ<EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ\n");
|
|
|
|
|
getchar();
|
|
|
|
|
next=getchar();
|
|
|
|
|
}
|
|
|
|
|
fseek(p,-sizeof(lxr),SEEK_CUR);
|
|
|
|
|
fwrite(&lxr,sizeof(lxr),1,p);
|
|
|
|
|
printf("<EFBFBD>ijɹ<EFBFBD>!\n");
|
|
|
|
|
fclose(p);
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
printf("û<EFBFBD>и<EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>\n");
|
|
|
|
|
fclose(p);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int shanchu(FILE *p)
|
|
|
|
|
{
|
|
|
|
|
p=fopen("txl.sto","rb+");
|
|
|
|
|
if(p==NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("ͨѶ¼Ϊ<EFBFBD>գ<EFBFBD><EFBFBD>뽨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
fclose(p);
|
|
|
|
|
getchar();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
person b;
|
|
|
|
|
person blank={};
|
|
|
|
|
char name[20];
|
|
|
|
|
int jishu=0;
|
|
|
|
|
rewind(p);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>");
|
|
|
|
|
scanf("%s",name);
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
while(!feof(p))
|
|
|
|
|
{
|
|
|
|
|
fread(&b,sizeof(b),1,p);
|
|
|
|
|
if(strcmp(name,b.name)==0)
|
|
|
|
|
{
|
|
|
|
|
fseek(p,-sizeof(b),SEEK_CUR);
|
|
|
|
|
fwrite(&blank,sizeof(blank),1,p);
|
|
|
|
|
printf("ɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!\n");
|
|
|
|
|
fclose(p);
|
|
|
|
|
jishu=jishu+1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(jishu==count&&(strcmp(name,b.name)!=0))
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
fclose(p);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|