




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
第三章圖書管理系統(tǒng)設(shè)計與實現(xiàn)3.1系統(tǒng)需求分析圖書登記管理系統(tǒng)作為一種應(yīng)用軟件將為學(xué)校教師和學(xué)生提供一種對學(xué)校圖書館進一步理解并借閱、還書平臺。依照系統(tǒng)界面提示信息對圖書館信息進行查詢、初始化等操作系統(tǒng)功能需求分析描述如下:(1)系統(tǒng)主菜單:進入系統(tǒng)和退出系統(tǒng)(2)功能菜單:顯示可以進行操作(3)查詢主菜單:依照圖書編號、書名、作者進行查詢,并可顯示所有圖書信息(4)借還書主菜單:可以進行借書和還書等操作3.2系統(tǒng)設(shè)計3.2.1系統(tǒng)總統(tǒng)設(shè)計下面從系統(tǒng)整體流程功能模塊、系統(tǒng)界面及數(shù)據(jù)構(gòu)造進行總體設(shè)計。(1)總體思想本系統(tǒng)重要設(shè)計思想是實現(xiàn)圖書館功能機管理系統(tǒng)信息查詢、借書、還書等重要功能。系統(tǒng)設(shè)計辦法是構(gòu)造化實際辦法,系統(tǒng)用C語言進行開發(fā)顧客可以清晰理解圖書館內(nèi)狀況。(2)系統(tǒng)模塊構(gòu)造圖依照需求分析成果,圖書管理系統(tǒng)可以分為三大模塊:查詢圖書模塊、借書功能模塊、還書功能模塊。系統(tǒng)模塊構(gòu)造如圖:圖書管理系統(tǒng)圖書管理系統(tǒng)還書功能系統(tǒng)借書功能系統(tǒng)圖書管理主菜單圖書查詢系統(tǒng)還書功能系統(tǒng)借書功能系統(tǒng)圖書管理主菜單圖書查詢系統(tǒng)3.2.2系統(tǒng)㈠系統(tǒng)主菜單。顯示系統(tǒng)主菜單,里面有相應(yīng)功能代碼,依照選取各功能代碼進入不同界面。功能重要涉及:退出系統(tǒng)、查詢圖書、借書、還書。㈡查詢圖書信息進入此菜單功能模塊,輸入您要查詢圖書編號、名字、作者等。 圖書查詢模塊流程如圖:開始開始提示輸入圖書編號、書名、作者輸入對的查詢否是重新輸入是重新輸入退出系統(tǒng)否退出系統(tǒng)3.3測試成果系統(tǒng)主界面功能菜單查詢系統(tǒng)菜單借還系統(tǒng)菜單3.4源代碼#include<stdio.h>#include<stdlib.h>#include<string.h>typedefstructlink{charnumber[100];charbookname[100];charauthor[100];charpublish[100];chartime[100];floatprice;charstatus[100];structlink*next;}link;link*Cbook(){intn=0;link*p,*q,*head;FILE*fp;fp=fopen("圖書信息.txt","r+");if(fp==NULL)printf("沒有找到文獻,請檢查……");p=(link*)malloc(sizeof(link));if(p==NULL)printf("申請內(nèi)存出錯!!!\n");fscanf(fp,"%s%s%s%s%s",p->number,p->bookname,p->author,p->publish,p->time);fscanf(fp,"%f",&p->price);fscanf(fp,"%s",p->status);while(feof(fp)==0){n++;if(n==1){ head=p;}else{q=p;p=(link*)malloc(sizeof(link));if(p==NULL)printf("申請內(nèi)存出錯!!!\n");fscanf(fp,"%s%s%s%s%s",p->number,p->bookname,p->author,p->publish,p->time);fscanf(fp,"%f",&p->price);fscanf(fp,"%s",p->status);q->next=p;}}p->next=NULL;fclose(fp);printf("信息已錄入!!!");returnhead;}voidmainmenu(){printf("\n*****************************************\n");printf("\n**歡迎使用圖書管理系統(tǒng)**\n");printf("\n**1.進入系統(tǒng)0.退出系統(tǒng)**\n");printf("\n*****************************************\n");printf("\n請選取");}voidmenu1(){printf("\n*****************************************\n");printf("\n**1.進入圖書查詢系統(tǒng)**\n");printf("\n**2.進入圖書借還系統(tǒng)**\n");printf("\n**3.保存所有圖書信息**\n");printf("\n**4.返回上級菜單**\n");printf("\n*****************************************\n");printf("\n請選取");}voidcxmenu(){printf("\n*****************************************\n");printf("\n**1.顯示所有圖書信息**\n");printf("\n**2.按編號查詢圖書**\n");printf("\n**3.按書名查詢圖書**\n");printf("\n**4.按作者查詢圖書**\n");printf("\n**5.返回上級菜單**\n");printf("\n****************************************\n");printf("\n請選取");}voidjhmenu(){printf("\n*****************************************\n");printf("\n**1.借書**\n");printf("\n**2.還書**\n");printf("\n**3.返回上級菜單**\n");printf("\n*****************************************\n");printf("\n請選取"); }voidprint(link*head){ link*p; p=head; printf("\n"); printf("\n**************************************************\n"); printf("\n編號\t\t書名\t\t作者\t\t出版社\t\t出版時間\t\t價格\t\t狀態(tài)\n"); while(p!=NULL) { printf("\n"); printf("%s\t%s\t%s\t%s\t%s",p->number,p->bookname,p->author,p->publish,p->time); printf("\t\t%.2f",p->price); printf("\t\t%s",p->status); printf("\n"); p=p->next; }}voidhold(link*head){link*p;FILE*fp;fp=fopen("圖書信息.txt","w+");if(fp==NULL){printf("文獻操作出錯!!!");exit(1); }p=head;for(;p!=NULL;p=p->next){ fprintf(fp,"%s\t%s\t%s\t%s\t%s",p->number,p->bookname,p->author,p->publish,p->time); fprintf(fp,"\t\t%.2f",p->price); fprintf(fp,"\t\t%s",p->status); fprintf(fp,"\n"); }fclose(fp);printf("信息已保存。");}voidholdcx(link*t){ link*p=NULL; FILE*fp; fp=fopen("查詢.txt","a+"); p=t; fprintf(fp,"查詢到信息為:\n"); fprintf(fp,"\n"); fprintf(fp,"\n**************************************************\n"); fprintf(fp,"\n編號\t\t書名\t\t作者\t\t出版社\t\t出版時間\t\t價格\t\t狀態(tài)\n"); fprintf(fp,"\n"); fprintf(fp,"%s\t%s\t%s\t%s\t%s",p->number,p->bookname,p->author,p->publish,p->time); fprintf(fp,"\t\t%.2f",p->price); fprintf(fp,"\t\t%s",p->status); fprintf(fp,"\n"); fclose(fp); printf("信息已保存!!!");}link*findnumber(link*head){charkey[100];link*h,*t1=NULL;printf("請輸入圖書編號:");getchar();gets(key);for(h=head;h!=NULL;h=h->next){if(strcmp(key,h->number)==0){ t1=h; break;}}returnt1;}link*findboookname(link*head){charkey[100];link*h,*t2=NULL;printf("請輸入圖書書名:");getchar();gets(key);for(h=head;h!=NULL;h=h->next){if(strcmp(key,h->bookname)==0){ t2=h; break;}}returnt2;}link*findauthor(link*head){charkey[100];link*h,*t3=NULL;printf("請輸入作者姓名:");getchar();gets(key);for(h=head;h!=NULL;h=h->next){if(strcmp(key,h->author)==0){ t3=h; break;}}returnt3;}link*sortnumber(link*head){ link*p,*q,*temp;temp=(link*)malloc(sizeof(link));if(temp==NULL){ printf("申請內(nèi)存出錯!!!"); exit(1);} for(p=head;p!=NULL;p=p->next) {for(q=p->next;q!=NULL;q=q->next) { if(strcmp(p->number,q->number)>0) { strcpy(temp->number,p->number); strcpy(temp->bookname,p->bookname); strcpy(temp->author,p->author); strcpy(temp->publish,p->publish); strcpy(temp->time,p->time); temp->price=p->price; strcpy(temp->status,p->status); strcpy(p->number,q->number); strcpy(p->bookname,q->bookname); strcpy(p->author,q->author); strcpy(p->publish,q->publish); strcpy(p->time,q->time); p->price=q->price; strcpy(p->status,temp->status); strcpy(q->number,temp->number); strcpy(q->bookname,temp->bookname); strcpy(q->author,temp->author); strcpy(q->publish,temp->publish); strcpy(q->time,temp->time); q->price=temp->price; strcpy(q->status,temp->status); } } }returnhead;}link*borrowbook(link*head){ link*h,*p; charch,ch1[100]="在庫",ch2[100]="不在庫"; h=head; printf("\n**************************************************\n"); printf("\t\t歡迎使用借書系統(tǒng)!!!\n"); p=findboookname(h); if(p==NULL) printf("借書失敗,書庫中沒有這本書!!!"); elseif(strcmp(p->status,ch2)==0) printf("借書失敗,圖書不在庫!!!"); else { printf("確認借出?Y/N:"); scanf("%c",&ch); getchar(); if(ch=='Y'||ch=='y') { strcpy(p->status,ch2); printf("借書成功,請返回上級菜單保存信息!!!"); } if(ch=='N'||ch=='n') { printf("你沒有借任何書!!!"); } }returnhead;}link*returnbook(link*head){ link*h,*p; charch,ch1[100]="在庫",ch2[100]="不在庫"; h=head; printf("\n**************************************************\n"); printf("\t\t歡迎使用還書系統(tǒng)!!!\n"); p=findboookname(h); if(p==NULL) printf("還書失敗,這不是本書庫書!!");else{ printf("確認還書?Y/N:"); scanf("%c",&ch); getchar(); if(ch=='Y'||ch=='y') { strcpy(p->status,ch1); printf("還書成功,請返回上級菜單保存信息!!!"); } if(ch=='N'||ch=='n') { printf("你沒有還書!!!"); }} returnhead;}voidmain(){inta,b,c,d;link*h,*t;L:system("cls");mainmenu();while(1){scanf("%d",&a);switch(a){case1:{B:system("cls");menu1();while(1){ scanf("%d",&b); switch(b) { case1: { system("cls"); cxmenu(); while(1) { scanf("%d",&c); switch(c) { case1: { print(h); }break;case2: { t=findnumber(h); if(t==NULL) printf("沒有要查詢圖書!!!"); if(t!=NULL) { printf("查詢圖書為:"); printf("\n");printf("\n**************************************************\n"); printf("\n編號\t\t書名\t\t作者\t\t出版社\t\t出版時間\t\t價格\t\t狀態(tài)\n"); printf("\n"); printf("%s\t%s\t%s\t%s\t%s",t->number,t->bookname,t->author,t->publish,t->time); printf("\t\t%.2f",t->price); printf("\t\t%s",t->status); printf("\n"); } }break; case3: { t=findboookname(h); if(t==NULL) printf("沒有要查詢圖書!!!"); if(t!=NULL) { printf("查詢圖書為:"); printf("\n");printf("\n**************************************************\n"); printf("\n編號\t\t書名\t\t作者\t\t出版社\t\t出版時間\t\t價格\t\t狀態(tài)\n"); printf("\n"); printf("%s\t%s\t%s\t%s\t%s",t->number,t->bookname,t->author,t->publish,t->time); printf("\t\t%.2f",t->price); printf("\t\t%s",t->status); printf("\n"); } }break; case4: { t=findauthor(h); if(t==NULL) printf("沒有要查詢圖書!!!"); if(t!=NULL) { printf("查詢圖書為:"); printf("\n");printf("\n**************************************************\n"); printf("\n編號\t\t書名\t\t作者\t\t出版社\t\t出版時間\t\t價格\t\t狀態(tài)\n"); printf("\n"); printf("%s\t%s\t%s\t%s\t%s",t->number,t->bookname,t->author,t->publish,t->time); printf("\t\t%.2f",t->price); printf("\t\t%s",t->status); printf("\n"); } } break; case5: {
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 股權(quán)激勵合同模板:核心員工激勵方案
- 先進工業(yè)模具技術(shù)升級合同補充條款
- 豪華游艇衛(wèi)星電話租賃及全球語音數(shù)據(jù)傳輸合同
- 規(guī)范中小學(xué)校園設(shè)置管理
- Part5 Unit2 Health and Fitness 課件-【中職專用】高一英語(高教版2021基礎(chǔ)模塊2)(2023修訂版)
- 婦科護理病歷討論
- 門球培訓(xùn)班宣傳
- 2025屆福建省普通高中學(xué)業(yè)水平選擇性考試模擬(一)歷史試題
- 寧夏中衛(wèi)市中寧縣2024-2025學(xué)年八年級下學(xué)期期中生物試題(含答案)
- 黑龍江省哈爾濱市蕭紅中學(xué)2024-2025學(xué)年八年級下學(xué)期期中考試英語試卷(含筆試答案無聽力音頻及原文)
- 建筑起重機械轉(zhuǎn)場維修保養(yǎng)記錄表
- 水平定向鉆施工技術(shù)規(guī)程完整
- 傷害流行病學(xué)-課件
- 工程造價司法鑒定實施方案
- 人工智能標(biāo)準化白皮書
- 2021譯林版高中英語選擇性必修一課文翻譯
- 0720小罐茶品牌介紹
- 二級、三級電箱接線圖
- 2022年食品衛(wèi)生通則第三版(中文版)
- 頸椎功能障礙指數(shù),Neck Disabilitv Index,NDI
- 名著導(dǎo)讀《紅樓夢》PPT課件(完整版)
評論
0/150
提交評論