版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、蘇州市職業(yè)大學課程設(shè)計任務(wù)書課程名稱:計算機語言 C起訖時間:2007-12-31 至 2008-1-4院系:計算機工程系班級:07軟件測試指導教師:李金祥顧小晶系主任:宣仲良蘇州市職業(yè)大學課程設(shè)計說明書名稱:計算機語言C課程設(shè)計圖書登記管理程序2007年12月31日至 2008年1月4日共 1周院 系班 級 07軟件測試姓 名馬寶珠系主任教研室主任葉良指導教師李金祥 顧小晶1. 需求分析圖書登記管理系統(tǒng)作為一個應(yīng)用軟件將為學校的老師和學生提供一個對學校圖書館深入了解并借閱、還書的平臺。擁護根據(jù)系統(tǒng)界面的提示信息對圖書館信息進行查詢、初始化等操作系統(tǒng)功能需求分析描述如下 :(1)查詢圖書: 根
2、據(jù)圖書編號進行查詢, 讀者可以瀏覽或查詢相關(guān)圖書(2)系統(tǒng)主菜單:若未找到相應(yīng)的書籍返回到上一級目錄。(3)圖書登記:讀者輸入要查詢的編號、出版社、作者姓名等信息,系 統(tǒng)將進行處理。(4)初始化:輸入書號、書名、書籍的數(shù)量以空格隔開,建立新文件寫 入數(shù)據(jù)否則初始化失敗。( 5 )新書入庫:可讀入新書名稱、編號、數(shù)量以空格隔開看是否有此類書籍。(6)借書菜單:可輸入讀者編號和所借書編號或調(diào)用借書函數(shù)執(zhí)行借書功能。(7)還書菜單:可輸入讀者編號和所還書的編號執(zhí)行還書功能,還書后 修改圖書庫存量。(8)保存連接數(shù)據(jù):方便讀者了解圖書登記的相關(guān)信息,為圖書管理人員和讀者帶來便利。2. 總體設(shè)計下面從系
3、統(tǒng)的整體流程的功能模塊系統(tǒng)界面與數(shù)據(jù)結(jié)構(gòu)進行總體設(shè)計。(1) 總體思想本系統(tǒng)主要設(shè)計思想是實現(xiàn)圖書館的功能機管理系統(tǒng)信息的查詢、 初始化、添加新書、借書、還書等主要功能。圖書登記管理情況以文件的 形式儲存,系統(tǒng)的人機接口系用簡單的字符界面進行交互,系統(tǒng)的設(shè)計方 法是結(jié)構(gòu)化實際方法,系統(tǒng)用 C語言進行幵發(fā)用戶可以清晰的了解圖書館 內(nèi)的情況。(2 )系統(tǒng)模塊結(jié)構(gòu)圖根據(jù)需求分析結(jié)果,圖書登記管理系統(tǒng)可以分為三大模塊:查詢圖 書模塊、圖書登記管理模塊、系統(tǒng)控制平臺。系統(tǒng)模塊結(jié)構(gòu)如圖:圖書管理系魏圖書管理主萊單TH書功能乘統(tǒng)一1B全部信息模珠光川永塊、:壬養(yǎng)單糅按,系統(tǒng)初船化模墳:唐書系躱摸塊:囹書查誨
4、模塊:懷書系球模按、扁出全部信兒樽塊3、概要設(shè)計系統(tǒng)主菜單。顯示系統(tǒng)的主菜單,里面有相應(yīng)的功能代碼,根據(jù)選擇各功能代碼進 入不同的界面。功能主要包括:退出系統(tǒng)、查詢圖書、借書、還書、新書 入庫。查詢圖書信息進入此菜單功能模塊,輸入您要查詢的圖書的編號、名稱、作者、出 版日期等。圖書查詢模塊流程如圖圖書登記管理模塊根據(jù)功能選擇進行操作,主要包括建立圖書入庫文件的保存與修改, 借書、還書文件的建立與修改。對系統(tǒng)進行初始化。4、數(shù)據(jù)結(jié)構(gòu)設(shè)計圖書信息和讀者信息的數(shù)據(jù)結(jié)構(gòu)系統(tǒng)云運用結(jié)構(gòu)體來存放圖書的 編號、作者、出版、借書、還書、新書入庫,讀者的編號、姓名、借書名 稱等信息。下面是結(jié)構(gòu)體的簡單描述:ty
5、pedef struct bkchar book_ nu m11;char book_ name41; int book_kc;int book_xc;struct bk * next;book;typedef struct rdchar reader_num11;char reader_name11;char reader_book_num11;struct rd * next ;reader;5 、系統(tǒng)流程描述系統(tǒng)進行初始化后, 根據(jù)提示輸入圖書、 讀者的相關(guān)信息后系統(tǒng)進入了 主菜單,根據(jù)選擇相應(yīng)的功能代碼進入不同的功能菜單。主要包括退出系 統(tǒng)、新書入庫、圖書查詢、借書、還書、輸出所有信息
6、功能。選擇代碼按 回車鍵即可進入,進入功能模塊后出現(xiàn)了不同選象,下面以進入借宿書模 塊為例:進入借書模塊后系統(tǒng)將提醒選擇 1 可返回主菜單,選擇 2 可正式進入 借書系統(tǒng)。選擇 2 后,系統(tǒng)提示“請輸入所借書的相關(guān)信息,讀者的相關(guān) 信息。圖 書 > 詢*甭統(tǒng)初始化屮1r圉書管理主菜 單選擇o代碼一新書庫存還書+諭 出 所 有 信 息J #僧書泵統(tǒng)輸出栢關(guān) 館息6、界面設(shè)計一、系統(tǒng)主菜單void M_Form() char ch;prin tf("nThe main wi ndow of books man age ");prin tf("n 0:Exit&q
7、uot;);prin tf("n 1:New book in store");printf("n 2:Book check");printf("n 3:Borrow book check in");printf("n 4:Return book check in");printf("n 5:Out put all information");doprintf("nn Please chose the code: ");scanf("%c",&ch)
8、;fflush(stdin);while(ch!='0'&&ch!='1'&&ch!='2'&&ch!='3'&&ch!='4'&&ch!='5')Jswitch(ch) case '0':exit(0);case '1':Form_Insert_New_Book();break;case '2':Form_Find_Book();break;case '3'
9、;:Form_Borrow_Book();break;case '4':Form_Return_Book();break;case'5':load_data();print_book(h_book);print_reader(h_reader);M_Form( );default:printf("errorn");exit(0);Thft main yiniioui nF hnnkf: manage9:Exit1 =Neu Jbuijk Ins Xu2"Book check3 :Boffw be ok check in4 = Rt:
10、 t-urn boo K 心hGck in& :Out wt si! infomat ianPlcrtie cliue Llie c-udei_L主糜單界面二、系統(tǒng)初始化模塊void ini t_book() book ba3;FILE *fp;int i;printf("n System will initialize , Book initialize module :n");printf("n Enter 3books ' num , name , quantity(Space out withblank): n ");for(i=
11、0;i<3;i+)sea nf("%s%s%d",bai.book_ nu m,bai.book_ name,&bai.book_kc);for(i=0;i<3;i+) bai.book_xc二bai.book_kc;if(fp=fope n("book.dat","wb")=NULL) printf("Book 't be founded, Initialize fail ! Please restar system !n"); return; for(i=0;i<3;i+) i
12、f(fwrite(&bai,sizeof(struct bk),1,fp)!=1) printf("Write date wrong! n"); exit(0); fclose(fp);三、新書入庫模塊void In sert_New_Book(char book_ nu m,char book_ name,i ntnu mber) struct bk *book_fp;struct bk *p,*q,*t;q=P=h_book;while(p!二NULL&&strcmp(p->book_ nu m,book_ nu m)!=0) q=p;p=
13、p->n ext; if(strcmp(p->book_ nu m,book_ nu m)=0) printf("nttThis num already exist, Please reorder!'n");retur n;t=(struct bk *)malloc(sizeof(struct bk);strcpy(t->book_num,book_num); strcpy(t->book_name,book_name);t->book_kc=t->book_xc=number;q->next=t;t->next=NU
14、LL;if(book_fp=fopen("book.dat","ab")=NULL) printf("Book 't be founded,Initialize fail ! Please restar system !n"); return; fwrite(t,sizeof(struct bk),1,book_fp);fclose(book_fp);void print_book(struct bk *h) struct bk *p;p=h;printf("ntBook numtBook nametStore qu
15、antitytNowquantityn");while(p!=NULL) printf(" %10st %10s %10dt%10dn",p->book_num,p->book_na me,p->book_kc,p->book_xc);p=p->next;四、借書模塊void Borrow_Book(char reader_ nu m,char book_ nu m) struct bk *book_p;struct rd *reader_p;book_p=h_book;while(book_p!二NULL&&strc
16、mp(book_p->book_ nu m,book_ nu m)!二0)book_p=book_p->n ext;if(book_p=NULL) printf("n'tThis num of book no exist! n”);Form_Borrow_Book();reader_p=h_reader;while(reader_p!=NULL&&( strcmp(reader_p->reader_ nu m,reader_ num)!=0)reader_p=reader_p->n ext;if(reader_p=NULL) print
17、f("ntThis num of reader no exist! n");Form_Borrow_Book();else if(strcmp(reader_p->reader_book_num,"0")!=0)! n"); printf("ntalready reach the top, Can't borrow againForm_Borrow_Book();else book_p->book_xc=book_p->book_xc-1; strcpy(reader_p->reader_book_nu
18、m,book_p->book_num); save();load_data();Form_Borrow_Book();五、還書功能模塊void Retur n_Book(char reader_ nu m,char book_ nu m) struct bk *book_p;struct rd *reader_p;book_p=h_book;while(book_p!二NULL&&strcmp(book_p->book_ nu m,book_ nu m)!二0)book_p=book_p->n ext;if(book_p=NULL) printf("
19、n'tThis num of book no exist! n”);Form_Retur n_Book();reader_p=h_reader;while(reader_p!=NULL&&( strcmp(reader_p->reader_ nu m,reader_ n um)!=0) reader_p=reader_p->next;if(reader_p=NULL) printf("nttThis num of reader no exist! n");Form_Return_Book();else if(strcmp(reader_p
20、->reader_book_num,book_num)!=0) printf("ntReader didn't borrow this bookn");Form_Return_Book();else book_p->book_xc=book_p->book_xc+1;strcpy(reader_p->reader_book_num,"0");save();load_data();Form_Return_Book();六、輸出所有信息模塊void Formnsert_New_Book() char ch;struct bk
21、t;printf("n New book instor module,Please chose the code : n");prin tf(" 0:Retur n main menun");prin tf(" 1:New book in store");doprintf("nn Please chose the code:");sca nf("%c", &ch);fflush(stdi n);while(ch!='0'&&ch!='1'&
22、amp;&ch!='2'&&ch!=3&&ch!='4'&&ch!='5')Jswitch(ch) case 'O':M_Form();break;case '1': printf(" nEnter book's num name quantity( Space out withblank ):");sea nf("%s%s%d",t.book_ nu m,t.book_ name,& t.book_kc
23、);fflush(stdi n);In sert_New_Book(t.book_ nu m,t.book_ name,t.book_kc);Form _ln sert_New_Book();default:pri ntf("errorn");exit(O);-|n| x|he nain wmdoy -of books rvanagre 8:Exit1 -New lioulk insttJi'c:2*Bool eheck3:Borrov Bock check in4-Return ibodk clieck in5 : Out put alL IiriFopniaLt
24、 xonPlease chose the codeRnnk num010203fi4B00K4Fnnk nanR ho okl book2 book3501020罷2030砧Nnw anAntituFcaclez'1 s noneTlic nun of h jls Ijo iri'u01>a02zhao03shuSi出蔚有信息界面程序清單:#in elude <stdio.h>#in elude vgraphics.h>#in clude <math.h> #include <string.h>typedef struct bkc
25、har book_num11;char book_name41;int book_kc;int book_xc;struct bk * next;book;typedef struct rdchar reader_num11;char reader_name11;char reader_book_num11;struct rd * next ;reader;struct bk * h_book,* h_reader;void Form_Insert_New_Book();void Form_Find_Book();void Form_Borrow_Book();void Form_Return
26、_Book();void Find_Book(char *);void Borrow_Book(char *,char *);void Return_Book(char *,char *);void print_book(struct bk *);void print_reader(struct rd *);void load_data();void init_reader();void init_book();void save();void M_Form() char ch;printf("nThe main window of books manage ");prin
27、tf("n 0:Exit");printf("n 1:New book instore");printf("n 2:Book check");printf("n 3:Borrow book check in");printf("n 4:Return book check in");printf("n 5:Out put all information");doprintf("nn Please chose the code: ");scanf("
28、%c",&ch);fflush(stdin); while(ch!='0'&&ch!='1'&&ch!='2'&&ch!='3'&&ch!='4'&&ch!='5')switch(ch) case '0':exit(0);case '1':Form_Insert_New_Book();break;case '2':Form_Find_Book();brea
29、k;case '3':Form_Borrow_Book();break;case '4':Form_Return_Book();break;case'5':load_data();print_book(h_book);print_reader(h_reader);M_Form();default:printf("errorn");exit(0);void Form_Find_Book() char ch;char book_num11;printf("n Book check module, Please chose
30、 the code :n");printf(" 0:Return to main menun");printf(" 1:Book check");doprintf("nn Please chose the code: ");scanf("%c",&ch);fflush(stdin);while(ch!='0'&&ch!='1');switch(ch) case '0':M_Form();break;case '1':
31、printf(" nEnter need book' s num:");scanf("%s",book_num);fflush(stdin);Find_Book(book_num);Form_Find_Book();default:printf("errorn");exit(0);void Find_Book(char book_num) struct bk *p;p=h_book;while(p!=NULL&&strcmp(p->book_num,book_num)!=0) p=p->next;!
32、n");if(p=NULL) printf("ntThe num of book no exist else printf("ntBook numtBook nametStoreroom quantitytNow quantity n"); printf(" %10st %10st %dt %dtn",p->book_num,p->book_nam e,p->book_kc,p->book_xc);getch();void init_book() book ba3;FILE *fp;int i;printf(&
33、quot;n System will initialize,Book initialize module :n");printf("n Enter 3books' num , name ,quantity ( Space out withblank ):n ");for(i=0;i<3;i+) scanf("%s%s%d",bai.book_num,bai.book_name,&bai.book_kc);for(i=0;i<3;i+) bai.book_xc=bai.book_kc; if(fp=fopen(&quo
34、t;book.dat","wb")=NULL) printf("Book 't be founded,Initialize fail ! Please restar system !n"); return; for(i=0;i<3;i+) if(fwrite(&bai,sizeof(struct bk),1,fp)!=1) printf("Write date wrong! n"); exit(0); fclose(fp);void init() int drive=DETECT,mode=0; ini
35、tgraph(&drive,&mode,"");init_book(); init_reader();void Insert_New_Book(char book_num,char book_name,int number) struct bk *book_fp;struct bk *p,*q,*t; q=p=h_book;while(p!=NULL&&strcmp(p->book_num,book_num)!=0) q=p;p=p->next; if(strcmp(p->book_num,book_num)=0) prin
36、tf("nttThis num already exist, Please reorder!n");return;t=(struct bk *)malloc(sizeof(struct bk); strcpy(t->book_num,book_num); strcpy(t->book_name,book_name);t->book_kc=t->book_xc=number; q->next=t;t->next=NULL;if(book_fp=fopen("book.dat","ab")=NULL)
37、printf("Book 't be founded,Initialize fail ! Please restar system !n"); return; fwrite(t,sizeof(struct bk),1,book_fp); fclose(book_fp);void print_book(struct bk *h) struct bk *p;p=h;printf("ntBook numtBook nametStore quantitytNow quantityn");while(p!=NULL) printf(" %10st
38、 %10s %10dt%10dn",p->book_num,p->book_na me,p->book_kc,p->book_xc);p=p->next;void print_reader(struct rd *h) struct rd *p;p=h; printf("ntReader's numtRead's nametThe num of his borrown");while(p!=NULL) printf(" %10st %10s %10sn",p->reader_num,p->
39、reader_name,p ->reader_book_num);p=p->next;getch();void Form_Borrow_Book() char ch;char book_num11,reader_num11;printf("n Book borrow module, Please chose the code : n");printf(" 0:Return main menun");printf(" 1:Book borrown");doprintf("nn Please chose the co
40、de: ");scanf("%c",&ch);fflush(stdin); while(ch!='0'&&ch!='1');switch(ch) case '0':M_Form();break;case '1': printf(" nEnter read's num and borrow book's num:( Space outwith blank ) ");scanf("%s%s",reader_num,book_n
41、um);fflush(stdin);Borrow_Book(reader_num,book_num);Form_Borrow_Book(); default:printf("errorn");exit(0);void Borrow_Book(char reader_num,char book_num) struct bk *book_p;struct rd *reader_p; book_p=h_book;while(book_p!=NULL&&strcmp(book_p->book_num,book_num)!=0) book_p=book_p-&g
42、t;next;if(book_p=NULL) printf("ntThis num of book no exist! n");Form_Borrow_Book();while(reader_p!=NULL&&(strcmp(reader_p->reader_num,reader_num)!=0)reader_p=reader_p->next; if(reader_p=NULL) printf("ntThis num of reader no exist! n");Form_Borrow_Book();else if(strc
43、mp(reader_p->reader_book_num,"0")!=0) printf("ntalready reach the top,Can't borrow again ! n");Form_Borrow_Book();else book_p->book_xc=book_p->book_xc-1; strcpy(reader_p->reader_book_num,book_p->book_num); save();load_data();Form_Borrow_Book();void Form_Return_
44、Book() char ch;:n");Space outprintf("n Return book module,Please chose the codeprintf(" 0:Return main menun");printf(" 1:Return bookn");doprintf("nn Please chose the code: ");scanf("%c",&ch);fflush(stdin);while(ch!='0'&&ch!='1
45、');switch(ch) case '0':M_Form();break;case '1': printf(" nEnter reader's num and return book's num: with blank ) ");scanf("%s%s",reader_num,book_num);fflush(stdin);Return_Book(reader_num,book_num); Form_Return_Book();default:printf("errorn");
46、exit(0); struct bk *book_p;struct rd *reader_p;book_p=h_book;while(book_p!=NULL&&strcmp(book_p->book_num,book_num)!= 0)book_p=book_p->next; if(book_p=NULL) printf("ntThis num of book no exist! n");Form_Return_Book();reader_p=h_reader;while(reader_p!=NULL&&(strcmp(read
47、er_p->reader_num,reader_n um)!=0)reader_p=reader_p->next; if(reader_p=NULL) printf("nttThis num of reader no exist! n");Form_Return_Book();else if(strcmp(reader_p->reader_book_num,book_num)!=0) printf("ntReader didn't borrow this bookn"); Form_Return_Book(); else boo
48、k_p->book_xc=book_p->book_xc+1;strcpy(reader_p->reader_book_num,"0");save();load_data();Form_Return_Book();void init_reader() FILE *fp;reader ra3;int i;printf("n System will initialize reader:n");printf("n Enter 3 readers' num and name( Space out with blank ):n
49、");for(i=0;i<3;i+)scanf("%s%s",rai.reader_num,rai.reader_name);for(i=0;i<3;i+)strcpy(rai.reader_book_num,"0");if(fp=fopen("reader.dat","wb")=NULL) printf("Reader's 't be founded,initialize fail !Please restar system !n"); return; f
50、or(i=0;i<3;i+) if(fwrite(&rai,sizeof(struct rd),1,fp)!=1) printf("Write date wrong! n"); exit(0); void Form_Insert_New_Book() char ch;struct bk t;printf("n New book instor module,Please chose the code : n");printf(" 0:Return main menun");printf(" 1:New book
51、instore");doprintf("nn Please chose the code: ");scanf("%c",&ch);fflush(stdin); while(ch!='0'&&ch!='1'&&ch!='2'&&ch!='3'&&ch!='4'&&ch!='5') switch(ch) case '0':M_Form();break;
52、case '1': printf(" nEnter book's num name quantity( Space out withblank ): ");fflush(stdin);Insert_New_Book(t.book_num,t.book_name,t.book_kc); Form_Insert_New_Book();default:printf("errorn");exit(0);void load_data() struct bk *book_p1,*book_p2,*book_p3; struct rd *rea
53、der_p1,*reader_p2,*reader_p3; FILE *fp_book,*fp_reader;fp_book=fopen("book.dat","rb"); book_p1=(struct bk *)malloc(sizeof(struct bk); fread(book_p1,sizeof(struct bk),1,fp_book); h_book=book_p3=book_p2=book_p1;while(! feof(fp_book) book_p1=(struct bk *)malloc(sizeof(struct bk); fread(book_p1,sizeof(struct bk),1,fp_book); book_p2->next=book_p1;book_p3=book_p2;book_p2=book_p1; book_p3->next=NULL; free(boo
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 軟件行業(yè)市場營銷總結(jié)
- 職業(yè)高中體育老師個人教學工作年終總結(jié)合集(5篇)
- 幼兒園小班教案《感恩大樹》及教學反思
- 超市零售行業(yè)會計工作總結(jié)
- 2024年版特定擔保事務(wù)合作合同模板版B版
- 辦公用品行業(yè)營業(yè)員工作總結(jié)
- 2024年外債借款合同展期與債務(wù)重組及還款能力評估范本3篇
- 2024年度水文地質(zhì)勘察與評價服務(wù)合同3篇
- 果茶制作課程設(shè)計
- 特殊鑿井課程設(shè)計
- 機架結(jié)構(gòu)設(shè)計
- 護理部副主任績效考核評分細則表
- 手衛(wèi)生規(guī)范課件
- “統(tǒng)計與概率”在小學數(shù)學教材中的編排分析
- 臭氧發(fā)生器確認方案W
- xx中心小學綜合實踐基地計劃模板(完整版)
- 談心談話記錄表 (空白表)
- LY/T 1863-2009自然保護區(qū)生態(tài)旅游評價指標
- T-JSTJXH 15-2022 裝配式勁性柱-鋼梁框架結(jié)構(gòu)設(shè)計規(guī)程
- 2023年上海市市高考物理一模試卷含解析
- 市政工程人行道維修方案
評論
0/150
提交評論