《C语言程序设计》课程设计报告(图书信息管理系统) 联系客服

发布时间 : 星期日 文章《C语言程序设计》课程设计报告(图书信息管理系统)更新完毕开始阅读31012ed626284b73f242336c1eb91a37f1113282

{ head=p1; head->next=NULL; } else { while((p1->num>p2->num)&&(p2->next!=NULL)) { p3=p2; p2=p2->next; } if(p1->num<=p2->num) { if(head==p2) head=p1; else p3->next=p1; p1->next=p2; } else { p2->next=p1; p1->next=NULL; } } return head; }

/*....................................................查询功能...................................................*/ void Check(struct bookinf * head) //查询,书名,作者名 { struct bookinf * ptr; char a; char bname[10]; char wname[10]; printf(\ printf(\ scanf(\ if(head==NULL) printf(\ else //链表非空 { switch(a) {

case '1': //按书名查询 printf(\ scanf(\ for(ptr=head;ptr;ptr=ptr->next) { if(strcmp(ptr->bname,bname)==0 ) { printf(\ dlnum bname aname scnum plname time price\\n\

printf(\

ptr->clanum,ptr->pubcom,ptr->pubtime,ptr->price); if(ptr==NULL) printf(\ } } break; case '2': //按作者名查询 printf(\ scanf(\ for(ptr=head;ptr;ptr=ptr->next) { if(strcmp(ptr->wname,wname)==0) { printf(\ num bname wname clanum pubcom pubtime price\\n\

printf(\

ptr->clanum,ptr->pubcom,ptr->pubtime,ptr->price); if(ptr==NULL) printf(\ } } break; default: printf(\ break; } } }

/*..................................................浏览功能..............................................*/ void Ptrint_Stu_Doc(struct bookinf *head)//浏览 { struct bookinf * ptr; if(head==NULL) printf(\ else { printf(\ printf(\ ptr=head; while(ptr!=NULL) { printf(\%ld %s %s %s %s %s %6.3f \\n\

ptr=ptr->next; } } }

/*.................................................修改功能.........................................................*/ struct bookinf * Revise(struct bookinf * head) //定义子函数 { struct bookinf * p1; int num;

char bname[20]; char wname[10]; char clanum[14]; char pubcom[10]; char pubtime[10]; float price; printf(\输出 scanf(\读取 长整形输出 if(head==NULL) //开头空 printf(\输出没结果 换行 else { for(p1=head;p1;p1=p1->next) { if(p1->num=num) { printf(\om,p1->pubtime,p1->price); //字节 大小

printf(\输出

scanf(\//读

p1->num=num; strcpy(p1->bname,bname); //读取 strcpy(p1->wname,wname); strcpy(p1->clanum,clanum); strcpy(p1->pubcom,pubcom); strcpy(p1->pubtime,pubtime); p1->price=price; } break; //退出循环 } if(p1==NULL)// p1空 printf(\ } return head; }

/*.............................................................删除功能...................................................*/ struct bookinf * Delete(struct bookinf * head) //删除 { struct bookinf * ptr1,* ptr2; //定义 指针1 2 int num; printf(\ scanf(\ if(head==NULL) //链表空 return NULL; else { while(head!=NULL && head->num==num) //要被删除结点为表头结点 { ptr2=head; head=head->next; printf(\ num bname wname clanum pubcom pubtime price\\n\

printf(\字节

ptr2->clanum,ptr2->pubcom,ptr2->pubtime,ptr2->price); free(ptr2); //释放 } //要被删除结点为非表头结点 ptr1=head;