计算机程序设计漫谈心得(4)

2020-07-01 09:48

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,


计算机程序设计漫谈心得(4).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:气流纺挡车工操作技术标准

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: