c语言print_head函数,分装的函数调用()

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

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;

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值