C語(yǔ)言課程設(shè)計(jì)圖書管理系統(tǒng)_第1頁(yè)
C語(yǔ)言課程設(shè)計(jì)圖書管理系統(tǒng)_第2頁(yè)
C語(yǔ)言課程設(shè)計(jì)圖書管理系統(tǒng)_第3頁(yè)
C語(yǔ)言課程設(shè)計(jì)圖書管理系統(tǒng)_第4頁(yè)
C語(yǔ)言課程設(shè)計(jì)圖書管理系統(tǒng)_第5頁(yè)
已閱讀5頁(yè),還剩19頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、c語(yǔ)言課程設(shè)計(jì)姓名:郭獻(xiàn)安 班級(jí):054101-13 學(xué)號(hào):20101001871 圖書管理系統(tǒng)目錄一、 題目要求及能實(shí)現(xiàn)的功能2二、 程序總體設(shè)計(jì)2三、 詳細(xì)設(shè)計(jì)1、主函數(shù)42、各功能模塊設(shè)計(jì)5四、 附 錄26題目要求及能實(shí)現(xiàn)的功能圖書管理信息包括:圖書名稱、圖書編號(hào)、單價(jià)、作者、存在狀態(tài)、借書人姓名、性別、學(xué)號(hào)等,使之能提供以下功能:1、新進(jìn)圖書基本信息的輸入。2、圖書基本信息的查詢。3、對(duì)撤消圖書信息的刪除。4、辦理借書手續(xù)。5、辦理還書手續(xù)【提示】建立圖書管理信息結(jié)構(gòu)體,結(jié)構(gòu)體成員包括圖書館名稱、圖書編號(hào)、單價(jià)啊、作者、存在狀態(tài)、借書人姓名、性別、學(xué)號(hào)。存在狀態(tài)設(shè)為整型,可用不同的數(shù)字

2、代表借還狀態(tài)。借書和還書手續(xù)要注意修改結(jié)構(gòu)題的成員變量存在狀態(tài)的值。總體設(shè)計(jì)歡迎進(jìn)入地大圖書管理系統(tǒng)查閱圖書借閱圖書退出系統(tǒng)圖書歸還管理系統(tǒng) 歡迎進(jìn)入管理系統(tǒng)增加圖書刪除圖書學(xué)生管理系統(tǒng)圖書統(tǒng)計(jì)修改圖書 詳細(xì)設(shè)計(jì)1、主函數(shù)說明 主函數(shù)較多、較復(fù)雜,已經(jīng)和主菜單函數(shù)合并,主菜單函數(shù)里還包括了各自的二級(jí)菜單,并已經(jīng)開始了對(duì)各個(gè)函數(shù)的調(diào)用。為了程序顯示的清晰可讀,應(yīng)先清屏之后調(diào)用菜單函數(shù)。流程 開 始 顯 示 一 系 列 功 能 選 項(xiàng) 輸入n,判斷n是否是04? 調(diào) 用 與 n 相 應(yīng) 的 模 塊ny2、各功能模塊設(shè)計(jì)(2)查閱模塊說明輸入個(gè)員工信息后,瀏覽、查找、排序時(shí)同一個(gè)員工的所有信息都要同

3、時(shí)顯示,所以運(yùn)用結(jié)構(gòu)體運(yùn)行。數(shù)據(jù)信息存放在文件中,一條記錄對(duì)應(yīng)一條學(xué)生信息,方便管理。流程查 詢 系 統(tǒng)按書名查找按作者查找退 出輸 入不存在已出借無人借(3)借閱模塊說明查閱完圖書記錄后,用戶要借閱圖書,系統(tǒng)要在操作過程中提示用戶輸入流程,根據(jù)用戶所輸入的指令,幫助其完成借閱。流程借 閱 圖書輸 入 卡 號(hào)卡號(hào)存在輸入書名已出借不存在借閱成功返 回卡號(hào)不存在(4)管理模塊說明管理模塊最為復(fù)雜,管理所有的圖書及職工、學(xué)生的信息。先進(jìn)入總體的管理系統(tǒng),在這個(gè)系統(tǒng)中重點(diǎn)的操作是圖書的管理,為其中的1至4項(xiàng)(分別是增加圖書、刪除圖書、修改圖書資料、書籍統(tǒng)計(jì)),同時(shí)系統(tǒng)還連接了職工、學(xué)生管理兩個(gè)系統(tǒng),

4、為下一步的操作提供了條件。職工管理系統(tǒng)主要有增加圖書、刪除圖書、修改圖書資料、書籍統(tǒng)計(jì),學(xué)生管理系統(tǒng)主要有申請(qǐng)新卡、刪除卡號(hào)、借書統(tǒng)計(jì)、卡號(hào)統(tǒng)計(jì)四個(gè)模塊,用于管理學(xué)生登錄信息。流程歡迎進(jìn)入管理系統(tǒng)增加圖書刪除圖書學(xué)生管理系統(tǒng)圖書統(tǒng)計(jì)修改圖書 歡迎進(jìn)入學(xué)生管理系統(tǒng)申請(qǐng)新卡刪除卡號(hào)卡號(hào)統(tǒng)計(jì)借書統(tǒng)計(jì) 返回 (5)還書模塊說明 需要根據(jù)輸入員工的姓名及工號(hào)查找相應(yīng)的記錄,找到后增加刪除和修改功能。附錄圖書館管理系統(tǒng)設(shè)計(jì)源程序清單#include #include #include #include #define stack_init_size 10 #define ok 1 #define true

5、 1 #define error 0struct student int carnum; char lendbook10; student1000;struct book int booknum; char bookname20; float bookprice;char bookcreat20; int turefalse; book1000;struct car int carnum; char sex5;char studentname20; int studentclass; car1000;findbook() file *fp; char bookname10; int i; fp

6、=fopen(book.txt,r); printf(請(qǐng)輸入你要查找的書名:n); scanf(%s,bookname); for(i=0;fread(&booki,sizeof(struct book),1,fp)!=0;i+) if(strcmp(bookname,booki.bookname)=0) if(booki.turefalse=1) printf( 書號(hào) 書名 作者 n %d %s %s n,booki.booknum,booki.bookname,booki.bookcreat);printf(此書現(xiàn)在無人借閱n按任意鍵返回n); else printf(這本書已經(jīng)有人借出n

7、);fclose(fp);return 0; fclose(fp); return 0; printf(沒有你要查詢的書籍!n); fclose(fp); return 0; findbook1() file *fp; char bookcreat10; int i; fp=fopen(book.txt,r); printf(請(qǐng)輸入你要查找的作者名:n); scanf(%s,bookcreat); for(i=0;fread(&booki,sizeof(struct book),1,fp)!=0;i+) if(strcmp(bookcreat,booki.bookcreat)=0) if(bo

8、oki.turefalse=1) printf( 書號(hào) 書名 作者 n %d %s %s n,booki.booknum,booki.bookname,booki.bookcreat); printf(此書現(xiàn)在無人借閱n按任意鍵返回n); else printf(這本書已經(jīng)有人借出!n);fclose(fp);return 0; fclose(fp); return 0; printf(沒有你要查詢的書籍n); fclose(fp); return 0; chabook() char ch5; do printf( 1: 按書名查找 n); printf( 2: 按作者查找 n); print

9、f( 0: 返回 n); printf(請(qǐng)輸入02:n); ch5=getch(); switch(ch5) case 1:findbook();getch();break; case 2:findbook1();getch();break; case 0:break; default:printf(無此操作!n);getch();break; while(ch5!=0);return 0; lendbook() file *fp,*fp2; int i,n; int carnum; printf(請(qǐng)輸入借書人的:n卡號(hào):n); scanf(%d,&carnum); fp=fopen(car.

10、txt,r); for(i=0;fread(&cari,sizeof(struct car),1,fp)!=0;i+) if(cari.carnum=carnum) n=i; fclose(fp); printf(書名:n); scanf(%s,studentn.lendbook); fp=fopen(book.txt,r); for(i=0;fread(&booki,sizeof(struct book),1,fp)!=0;i+) if(strcmp(booki.bookname,studentn.lendbook)=0) if(booki.turefalse=0) printf(對(duì)不起,此

11、書有人借出,請(qǐng)借其他書n);fclose(fp);getch();return 0; else fclose(fp); fp=fopen(record.txt,a+); studentn.carnum=carnum; fwrite(&studentn,sizeof(struct student),1,fp); fclose(fp); fp=fopen(book.txt,r); fp2=fopen(bookl.txt,w); for(i=0;fread(&booki,sizeof(struct book),1,fp)!=0;i+) if(strcmp(booki.bookname,student

12、n.lendbook)=0) booki.turefalse=0; fwrite(&booki,sizeof(struct book),1,fp2); continue; fwrite(&booki,sizeof(struct book),1,fp2); fclose(fp); fclose(fp2); fp=fopen(book.txt,w); fp2=fopen(bookl.txt,r); for(i=0;fread(&booki,sizeof(struct book),1,fp2)!=0;i+) fwrite(&booki,sizeof(struct book),1,fp); fclos

13、e(fp); fclose(fp2); fopen(bookl.txt,w); fclose(fp2); printf(借書完畢,按任意鍵返回.n); getch(); return 0; printf(不存在這樣的書,任意鍵返回.n); fclose(fp); getch(); return 0; printf(你的卡號(hào)不存在,請(qǐng)申請(qǐng)新卡,按任意鍵返回.n); fclose(fp); getch(); return 0;huanbook() file *fp,*fp2; int i,n; int carnum; char lendbook10; printf(tt(_)歡迎進(jìn)入還書界面(_)

14、;printf(n請(qǐng)你輸入你的n卡號(hào):n); scanf(%d,&carnum); fp=fopen(car.txt,r); for(i=0;fread(&cari,sizeof(struct car),1,fp)!=0;i+) if(cari.carnum=carnum) n=i; fclose(fp); printf(請(qǐng)輸入你要還的書的名字:n); scanf(%s,lendbook); fp=fopen(record.txt,r); for(i=0;fread(&studenti,sizeof(struct student),1,fp)!=0;i+) if(strcmp(studenti

15、.lendbook,lendbook)=0) fclose(fp); fp=fopen(record.txt,r); fp2=fopen(bookl.txt,w); for(i=0;fread(&studenti,sizeof(struct student),1,fp)!=0;i+) if(strcmp(studenti.lendbook,lendbook)=0) continue; fwrite(&studenti,sizeof(struct student),1,fp2); fclose(fp); fclose(fp2); fp=fopen(record.txt,w); fp2=fopen

16、(bookl.txt,r); for(i=0;fread(&studenti,sizeof(struct student),1,fp2)!=0;i+) fwrite(&studenti,sizeof(struct student),1,fp); fclose(fp); fclose(fp2); fopen(bookl.txt,w); fclose(fp2); fp=fopen(book.txt,r); fp2=fopen(bookl.txt,w); for(i=0;fread(&booki,sizeof(struct book),1,fp)!=0;i+) if(i=n) booki.turef

17、alse=1; fwrite(&booki,sizeof(struct book),1,fp2); continue; fwrite(&booki,sizeof(struct book),1,fp2); fclose(fp); fclose(fp2); fp=fopen(book.txt,w); fp2=fopen(bookl.txt,r); for(i=0;fread(&booki,sizeof(struct book),1,fp2)!=0;i+) fwrite(&booki,sizeof(struct book),1,fp); fclose(fp); fclose(fp2); fopen(

18、bookl.txt,w); fclose(fp2); printf(還書完畢,按任意鍵返回.n); getch(); return 1; printf(你沒有借這樣的書,任意鍵返回.n); fclose(fp); getch(); return 0; printf(沒這樣的卡,和管理員聯(lián)系,按任意鍵返回.n); fclose(fp); getch(); return 0;lendcount() file *fp; int i,n=0; fp=fopen(record.txt,r); if(fp=fopen(record.txt,r)=0)printf(文件中沒有數(shù)據(jù)!n);printf(按任意

19、鍵返回.n); getch();return(0);for(i=0;fread(&studenti,sizeof(struct student),1,fp)!=0;i+) printf(卡號(hào) 借出的書籍 n); printf(%d %s n,studenti.carnum,studenti.lendbook); n=n+1; fclose(fp); printf(目前共有%d本書借出n,n); printf(按任意鍵.n); getch();return n; addcar() file *fp; int i=0; fp=fopen(car.txt,a+); printf(卡號(hào):n); sca

20、nf(%d,&cari.carnum); printf(性別:n);scanf(%s,cari.sex);printf(姓名:n); scanf(%s,cari.studentname); printf(班級(jí):n); scanf(%d,&cari.studentclass); fwrite(&cari,sizeof(struct car),1,fp); fclose(fp); printf(輸入完畢,任意鍵返回.n); getch(); delcar() file *fp,*fp2; int i; int carnum; char choice; fp=fopen(car.txt,r); fp

21、2=fopen(bookl.txt,w); printf(要?jiǎng)h除的卡號(hào)(不存在則不作改動(dòng)):n); scanf(%d,&carnum); for(i=0;fread(&cari,sizeof(struct car),1,fp)!=0;i+) if(cari.carnum!=carnum) fwrite(&cari,sizeof(struct car),1,fp2); fclose(fp); fclose(fp2); printf(確認(rèn)刪除?(y/n)!n); scanf(%s,&choice); if(choice=y|choice=y) fp=fopen(car.txt,w); fp2=fo

22、pen(bookl.txt,r); for(i=0;fread(&cari,sizeof(struct car),1,fp2)!=0;i+) fwrite(&cari,sizeof(struct car),1,fp); fclose(fp); fclose(fp2); fp2=fopen(bookl.txt,w); fclose(fp2); printf(操作超成功!n按任意鍵返回.n); getch(); return 0; else printf(操作已取消!n按任意鍵返回.n); getch(); return 0; carcount() file *fp; int i,n=0; fp=

23、fopen(car.txt,r); for(i=0;fread(&cari,sizeof(struct car),1,fp)!=0;i+) printf(第%d張卡 n,i+1); printf( 卡號(hào) 性別 姓名 班級(jí) n); printf(ttn); printf( %d %6s %10s %3d nn,cari.carnum,cari.sex,cari.studentname,cari.studentclass); n=n+1; fclose(fp); printf(目前共有%d個(gè)學(xué)生。n,n); printf(按任意鍵返回.n); getch(); addbook() file *fp

24、; int i=0; char choice=y; fp=fopen(book.txt,a+); while(choice=y|choice=y) printf(書號(hào):n); scanf(%d,&booki.booknum); printf(書名:n); scanf(%s,booki.bookname); printf(作者:n); scanf(%s,booki.bookcreat); printf(單價(jià):n); scanf(%f,&booki.bookprice); printf(請(qǐng)你設(shè)定書的狀態(tài)(1在架/0不在):n); scanf(%d,&booki.turefalse); fwrite

25、(&booki,sizeof(struct book),1,fp); printf(是否要輸入下本書(y/n)n); scanf(%s,&choice); fclose(fp); delbook() file *fp,*fp2; int i; char bookname10,choice; fp=fopen(book.txt,r); fp2=fopen(bookl.txt,w); printf(書名:n); scanf(%s,bookname); for(i=0;fread(&booki,sizeof(struct book),1,fp)!=0;i+) if(strcmp(bookname,b

26、ooki.bookname)!=0) fwrite(&booki,sizeof(struct book),1,fp2); fclose(fp); fclose(fp2); printf(確認(rèn)刪除(y/n)?n); scanf(%s,&choice); if(choice=y|choice=y) fp=fopen(book.txt,w); fp2=fopen(bookl.txt,r); for(i=0;fread(&booki,sizeof(struct book),1,fp2)!=0;i+) fwrite(&booki,sizeof(struct book),1,fp); fclose(fp)

27、; fclose(fp2); fp2=fopen(bookl.txt,w); fclose(fp2); printf(按任意鍵返回.n); getch(); return 0; else printf(按任意鍵返回.n); getch(); return 0; changebook() file *fp,*fp2; char bookname10,choice; int i; fp=fopen(book.txt,r); fp2=fopen(bookl.txt,w); printf(書名:n); scanf(%s,bookname); for(i=0;fread(&booki,sizeof(st

28、ruct book),1,fp)!=0;i+) if(strcmp(booki.bookname,bookname)=0) printf(你所要修改的書的資料如下,請(qǐng)選擇你要修改的內(nèi)容:n); printf(序號(hào) 書名 作者 n); printf(%d %s %sn,booki.booknum,booki.bookname,booki.bookcreat); printf(1: 修改書號(hào):n); printf(2: 修改書名:n); printf(3: 修改作者:n); printf(4: 修改單價(jià):); printf(請(qǐng)輸入13:); choice=getch(); switch(choic

29、e) case 1: printf(新的書號(hào):n); scanf(%d,&booki.booknum); fwrite(&booki,sizeof(struct book),1,fp2); break; case 2: printf(新的書名:n); scanf(%s,booki.bookname); fwrite(&booki,sizeof(struct book),1,fp2); break; case 3: printf(新的作者:n); scanf(%s,booki.bookcreat); fwrite(&booki,sizeof(struct book),1,fp2); break;

30、 case 4:printf(新的單價(jià):);scanf(%f,booki.bookprice); fwrite(&booki,sizeof(struct book),1,fp2); default:printf(沒有這樣的操作!);break; continue; fwrite(&booki,sizeof(struct book),1,fp2); fclose(fp); fclose(fp2); fp=fopen(book.txt,w); fp2=fopen(bookl.txt,r); for(i=0;fread(&booki,sizeof(struct book),1,fp2)!=0;i+)

31、 fwrite(&booki,sizeof(struct book),1,fp); fclose(fp); fp2=fopen(bookl.txt,w); fclose(fp2); printf(按任意鍵返回.n); getchar(); return 0; bookcount() file *fp; int i,n=0; fp=fopen(book.txt,r); for(i=0;fread(&booki,sizeof(struct book),1,fp)!=0;i+) if(booki.booknum!=0&strlen(booki.bookname)!=0&strlen(booki.bo

32、okcreat)!=0) printf(第%d本書n序號(hào) 書名 作者 單價(jià) 狀態(tài) n,i+1); printf(ttn);printf( %d %10s ,booki.booknum,booki.bookname); printf(%15s %4.2f %d(1在/0不在)n,booki.bookcreat,booki.bookprice,booki.turefalse);n=n+1; fclose(fp); printf(目前共有%d本書.n,n); printf(按任意鍵返回.n); end() printf(ttn);printf(ttn);printf(tt 謝謝使用本系統(tǒng) , 再見! n); printf(ttn); printf(ttn);main() char c

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論