master
parent 95d75d017c
commit 994488231f

@ -47,7 +47,7 @@ void main()
break;
case 5:b=shanchu(p);
break;
case 6:printf("感谢您的使用");
case 6:printf("感谢您的使用!");
break;
default:printf("请输入正确的序号:\n");
break;
@ -118,7 +118,7 @@ void liulan(FILE *p)
}
void chaxun(FILE *p)
{
int i=0;
int xuhao1=0;
p=fopen("txl.sto","rb+");
if(p==NULL)
{
@ -137,12 +137,12 @@ void chaxun(FILE *p)
{
printf("姓名: 籍贯: 电话号码1: 电话号码2: 邮箱:\n");
printf("%s %s %lld %lld %s\n",lxr.name,lxr.jiguan,lxr.num1,lxr.num2,lxr.email);
i=i+1;
xuhao1=xuhao1+1;
}
fread(&lxr,sizeof(lxr),1,p);
}
if(i==count&&(strcmp(mingzi,lxr.name)!=0))
if(xuhao1==count&&(strcmp(mingzi,lxr.name)!=0))
printf("无该联系人\n");
fclose(p);
}
@ -175,10 +175,10 @@ void xiugai(FILE *p)
printf("6.取消\n");
while(next=='Y')
{
int c;
int xuhao;
printf("请输入序号:");
scanf("%d",&c);
switch(c)
scanf("%d",&xuhao);
switch(xuhao)
{
case 1:printf("请修改姓名:");
scanf("%s",lxr.name);
@ -187,15 +187,17 @@ void xiugai(FILE *p)
scanf("%s",lxr.jiguan);
break;
case 3:printf("请修改电话号码1:");
scanf("%s",lxr.num1);
scanf("%lld",&lxr.num1);
break;
case 4:printf("请修改电话号码2:");
scanf("%s",lxr.num2);
scanf("%lld",&lxr.num2);
break;
case 5:printf("请修改邮箱:");
scanf("%s",lxr.email);
break;
default:printf("输入错误");
case 6:break;
default:printf("输入错误\n");
break;
}
printf("继续修改:Y\n停止修改:其他字母\n");
@ -223,6 +225,7 @@ int shanchu(FILE *p)
{
printf("通讯录为空,请建立新联系人!\n");
fclose(p);
getchar();
return 0;
}
else
@ -230,7 +233,7 @@ int shanchu(FILE *p)
person b;
person blank={};
char name[20];
int c=0;
int jishu=0;
rewind(p);
printf("请输入您要删除的联系人名称:");
scanf("%s",name);
@ -244,12 +247,12 @@ int shanchu(FILE *p)
fwrite(&blank,sizeof(blank),1,p);
printf("删除成功!\n");
fclose(p);
c=c+1;
jishu=jishu+1;
return 0;
}
}
if(c==count&&(strcmp(name,b.name)!=0))
if(jishu==count&&(strcmp(name,b.name)!=0))
printf("无该联系人!\n");
fclose(p);
return 0;

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save