switch(choice){
case 1:head=save2();break;
case 2:
head=createlist(); save(head); break;
void printbook(struct booknode *head){ struct booknode *temp;
for(temp=head;temp!=NULL;temp=temp->next) return head; }
default: break;}
printf(\p->pname,temp->sort,temp->time,temp->price);
void seekbook(struct booknode *head,char *bname){ struct booknode *temp;
int flag; }
flag=0; temp=head;
while(temp!=NULL){
if(strcmp(bname,temp->bname)==0){ flag=1;
printf(\%s %s %s %s %d %d\\n\temp->pname,temp->sort,temp->time,temp->price);
void orderbook(struct booknode *head){ struct booknode *p,*q,*small,*a; int price,choice;
price=0; }
break;} temp=temp->next;
}
if(flag==0)
printf(\
a=(struct booknode*)malloc(size);
printf(\:按价格排序2:按书名排序\ scanf(\ switch(choice){
case 1:{ for(p=head;p!=NULL;p=p->next){
small=p;
for(q=p->next;q!=NULL;q=q->next){ if(small->price>q->price) small=q; }
if(p!=small){ {a->num=p->num;
strcpy(a->bname,p->bname);
strcpy(a->wname,p->wname); strcpy(a->pname,p->pname);
strcpy(a->sort,p->sort); a->time=p->time; a->price=p->price;}
{p->num=small->num;
strcpy(p->bname,small->bname); strcpy(p->wname,small->wname); strcpy(p->pname,small->pname);
strcpy(p->sort,small->sort); p->time=small->time; p->price=small->price;}
{small->num=a->num;
strcpy(small->bname,a->bname); strcpy(small->wname,a->wname); strcpy(small->pname,a->pname);
strcpy(small->sort,a->sort); small->time=a->time; small->price=a->price;}
case 2:{for(p=head;p!=NULL;p=p->next){
small=p;
for(q=p->next;q!=NULL;q=q->next){ if(strcmp(small->bname,q->bname)>0)
} } break;}
small=q;
}
if(p!=small){ {a->num=p->num;
strcpy(a->bname,p->bname); strcpy(a->wname,p->wname); strcpy(a->pname,p->pname);
strcpy(a->sort,p->sort); a->time=p->time; a->price=p->price;}
{p->num=small->num;
strcpy(p->bname,small->bname); strcpy(p->wname,small->wname); strcpy(p->pname,small->pname);
strcpy(p->sort,small->sort); p->time=small->time; p->price=small->price;}
{small->num=a->num;
strcpy(small->bname,a->bname); strcpy(small->wname,a->wname); strcpy(small->pname,a->pname);
strcpy(small->sort,a->sort); small->time=a->time; small->price=a->price;}
} }
break;}
}
save(head); printbook(head); }
void tianjiabook(struct booknode *head){//添加图书信息 struct booknode *p,*q,*ptr; int num,time, price;
char bname[20],wname[20],pname[20],sort[20];
q=head; ptr=head->next; while(ptr!=NULL){ q=q->next; ptr=ptr->next;}
p=( struct booknode *)malloc(size); printf(\请输入图书相关的信息:\\n\
scanf(\
pname,sort,&time,&price);
p->num=num;
strcpy(p->bname,bname); strcpy(p->wname,wname);
strcpy(p->pname,pname);
strcpy(p->sort,sort); p->time=time;
wname,