该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
getch();
exit(1);
}
printf("please input the num you want to modify:");
gets(ch);
flag=0;
while(fread(&ct,sizeof(ct),1,fp1)==1)
{
if(ct.num==0)
{ print1(head);
print2(head);
printf("\n\nPlease input the new information:\n");
printf("\tnum:");gets(temp);
ct.num=atof(temp);
printf("\tname:");gets(ct.name);
printf("\tsex");gets(ct.sex);
printf("\tbirthday");
scanf("%s",ct.birthday);
getchar();
printf("\txueli:");
gets(ct.xueli);
printf("\tzhiwu:");gets(ct.zhiwu);
printf("\tgongzi:");gets(ct.gongzi);
printf("\tdianhua:");gets(ct.dianhua);
flag=1;
}
fwrite(&ct,sizeof(ct),1,fp2);
}
fclose(fp1);
fclose(fp2);
if(flag==1)
{
printf("Modify sucess!\n");
remove("xinxi.txt");
rename("temp.txt","inform.txt");
}
else
printf("can not find this record!\n");
printf("modify any more?(Y\N):[]\b\b");
f=getchar();getchar();
}while(f=='Y'||f=='y');
}
struct zhigong *shanchu(struct zhigong * head)
{
struct zhigong *pf,*pb;
char f;
char ch;
FILE *fp;
long number;
scanf("%ld",&number);
if((fp=fopen("xinxi.txt","rb"))==NULL)
{
printf("Can not open the xin file!");
getch();
exit(1);
}
do
{
if(head==NULL)
{
printf("\nkong de list\n");
goto end;
}
pb=head;
while(pb->num!=number&&pb->link!=NULL)
{
pf=pb;
pb=pb->link;
}
if(pb->num==number)
{
if(pb==head)
head=pb->link;
else
pf->link=pb->link;
free(pb);
printf("The link is shanchu");
}
else
printf("the link is not found!\n");
end:
printf("shanchu geng duo?(Y/N):[]\b\b");
f=getchar();
getchar();
}while(f=='Y'||f=='y');
fclose(fp);
}
main()
{
struct zhigong * head;
while(1)
switch(caidan())
{
case '1':creat();break;
case '2':xianshi(head);break;
case '3':chaxun(head);break;
case '4':xiugai(head);break;
case '5':shanchu(head);break;
case '6':exit(0);break;
}
}