编辑: 枪械砖家 2013-01-09

? int flag=0;

? struct node *p,*q;

? printf("Please input book name\n");

? printf("name:");

scanf("%s",sn);

? p=head;

? while(p!=NULL) ? { ? while(p!=NULL &&(strcmp(p->name,sn)!=0)) ?? { q=p;

p=p->link;

} ? if((strcmp(p->name,sn)==0)&& p!=NULL) ? { ?? flag=1;

?? printf(name??? price?? publshier\n");

?? printf("Book Found:? %s????? %5.2f??? %s\n",p->name,p->price,p->pub);

?? printf("Do you want to del this book(y/n)");

?? scanf("\n%c",&s);

?? if(s=='y' || s=='Y') ?? { ???? if(p==head)head=p->link;

???? else q->link=p->link;

???? free(p);

???? printf("This book is deleted!\n");

???? printf("\n\t\tPress any keys !");

?? } ?? else ??? { ???? printf("\nThis book not delete!\n");

???? printf("\n\t\tPress any keys!");

???? return head;

???? } ?? } ? else ??? { if(flag!=1) ???? { printf("\nNOT found!");

????? printf("\n\t\tPress any key!");

????? } ????? break;

???? } ?? if(p!=NULL) ?? { p=p->link;

} ? } ? return head;

?} ?void mhsearch(struct node *head)?{ ?? char s[15];

?? int flag=0;

?? struct node *p;

?? printf("Please input book name\n");

?? printf("name:");

scanf("%s",s);

?? p=head;

?? while(p!=NULL) ?? { ???? while(p!=NULL && (strstr(p->name,s)==NULL)) ???? {? p=p->link;

} ???? if(strstr(p->name,s)!=NULL) ???? { ????? printf(name??? price?? publshier\n");

????? printf("Book Found:? %s????? %5.2f??? %s\n",p->name,p->price,p->pub);

????? flag=1;

else ???? { if(flag!=1) printf("\nNOT found!");

? printf("\n\t\tPress any key!");

?????? } ?? } ????? if(p!=NULL) ????? { p=p->link;

} ?? } ?} ?struct node *mhdel(struct node *head) ?{ ? char sn[15],s;

? int flag=0;

? struct node *p,*q;

? printf("Please input book name\n");

? printf("name:");

scanf("%s",sn);

? p=head;

? while(p!=NULL) ? { ? while(p!=NULL &&(strstr(p->name,sn)==NULL)) ?? { q=p;

p=p->link;

} ? if((strcmp(p->name,sn)!=NULL)&& p!=NULL) ? { ?? flag=1;

?? printf(name??? price?? publshier\n");

?? printf("Book Found:? %s????? %5.2f??? %s\n",p->name,p->price,p->pub);

?? printf("Do you want to del this book(y/n)");

?? scanf("\n%c",&s);

?? if(s=='y' || s=='Y') ?? { ???? if(p==head)head=p->link;

???? else q->link=p->link;

???? free(p);

???? printf("This book is deleted!\n");

???? printf("\n\t\tPress any keys !");

;

?? } ?? else ??? { ???? printf("\nThis book not delete!\n");

???? printf("\n\t\tPress any keys!");

???? return head;

???? } ?? } ? else ??? { if(flag!=1) ???? { printf("\nNOT found!");

????? printf("\n\t\tPress any key!");

???? } ????? break;

???? } ???? p=head;

? }? return head;

下载(注:源文件不在本站服务器,都将跳转到源网站下载)
备用下载
发帖评论
相关话题
发布一个新话题