c語言程序設計報告圖書館信息管理系統(tǒng)_第1頁
c語言程序設計報告圖書館信息管理系統(tǒng)_第2頁
c語言程序設計報告圖書館信息管理系統(tǒng)_第3頁
c語言程序設計報告圖書館信息管理系統(tǒng)_第4頁
c語言程序設計報告圖書館信息管理系統(tǒng)_第5頁
已閱讀5頁,還剩31頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、2014年第二階段課程設計成果報告實訓項目: 程序設計技術課程設計 學號:20130210470335 姓名:鄭毓豪 專業(yè): 電氣工程及其自動化 實訓日期:2014年6月 8 日至2014年6月20日指導教師: 舒蔚 實訓成績: 華東交通大學理工學院一、 問題概述(對問題背景及主要實現(xiàn)的功能進行簡要說明。)隨著圖書館圖書的不斷增加,圖書管理的難度也隨之加大,一個好的圖書館圖書信息管理系統(tǒng),能夠使圖書管理工作簡便,有條不紊。通過c語言學習,我們已經(jīng)能夠完成基本的c語言編程,此次實訓,是將學習和實踐結合,充分感受c語言解決實踐問題的魅力。此次編寫的圖書館信息管理系統(tǒng),能夠實現(xiàn)基本的圖書管理功能。它

2、包括圖書庫的創(chuàng)建,打印圖書信息表,錄入新圖書,修改圖書信息,刪除圖書信息,借書,還書。圖書庫包含圖書的各方面信息,編號,類型,作者,出版社,總數(shù),剩余量等等,并且打印圖書信息表。錄入,修改,刪除這些功能都是對圖書庫的操作。借書,還書這兩項最重要的功能也都能很好的實現(xiàn)。把此系統(tǒng)應用于圖書館的圖書管理,能使圖書館的各項工作便捷,可靠的完成。二、 系統(tǒng)目標 (主要是對系統(tǒng)技術目標和要求)歡迎界面、主菜單、系統(tǒng)管理功能、圖書信息管理、借閱功能模塊、其中系統(tǒng)管理功能包括系統(tǒng)管理員添加、刪除、修改信息以及用管理員身份登錄系統(tǒng)等功能。圖書信息管理包括新增圖書、修改圖書、刪除圖書、等功能。借閱功能模塊包括借書

3、功能、還書功能、查詢已借圖書、查詢過期未還圖書,其中借書還書功能可以按圖書編號信息進行操作。三、 設計的過程及步驟1、需求分析(描述系統(tǒng)需求,既詳細分析系統(tǒng)需求和功能)根據(jù)題目要求,應當把圖書信息用結構體形式輸入,再定義一個全局變量和文件指針進行整個程序的運行,然后把圖書信息送到文件中,所以應該提供一個結構體和文件的輸入輸出等操作;在程序中需實現(xiàn)圖書信息錄入,瀏覽,查詢,刪除和修改等功能的操作,所以需要建立相應的模塊來實現(xiàn);另外還需提供鍵盤式選擇菜單實現(xiàn)功能,在運行時達到所要目的。2、設計文件結構(設計文件結構,并扼要說明設計緣由)此系統(tǒng)根據(jù)所要實現(xiàn)的功能,使用的函數(shù)等綜合考慮,設計了兩個,圖

4、書信息文件(tushu.red),借還書文件(borrow.red),錄入新圖書,修改,刪除圖書等一些操作時在圖書信息文件上運行,借還書功能則在借還書文件上運行,同時也要在圖書信息文件上運行。兩個文件相互結合,使各個功能很好的實現(xiàn)了,運用c語言的文件功能,也是整個程序的主線。3、設計系統(tǒng)功能圖(根據(jù)需求分析結果和文件結構,應用結構化分析與設計技術設計功能結構圖,如下圖所示)圖書管理信息系統(tǒng)創(chuàng)建文件信息基本信息管理圖書流通管理圖書統(tǒng)計借書管理還書管理本月借出統(tǒng)計超期未還統(tǒng)計統(tǒng)計按期歸還率按圖書類別查詢按書名查詢按作者名查詢圖書查詢圖書管理信息系統(tǒng)圖書輸入與追加刪除圖書記錄修改圖書記錄顯示圖書信息

5、借書統(tǒng)計報表 4、函數(shù)設計( 詳細分析每一個子模塊的子功能,定義主要的子函數(shù)原型,并對每一個函數(shù)的功能加以說明)此系統(tǒng)主要有7個功能,也就有主要的7個函數(shù),他們分別是void shan() /刪除圖書信息void xiu() /修改圖書信息void putin() /錄入新圖書void print() /打印圖書信息表void returned() /還書void books() /創(chuàng)建圖書文件void borrowed() /借書其中每一個函數(shù)都用到了兩個結構體,它們分別是:struct tushu char bianhao110; char bianhao210; char leixing

6、20; char shuming50; char chubanshe50; char writer20; long zongshu; long shengyu; shu;struct books char bianhao110; char bianhao210; long nian; long borrowmonth; long borrowday; long returnedmonth; long returnedday; long limittime; char student10; book;四、 實訓成果(對自己的最后的實驗成果進行概括)經(jīng)過長達9天的編寫,修改,運行,最后完成時,預想

7、的功能都能比較好的實現(xiàn)。下面是各個功能運行的界面:進入界面 :功能選擇界面 :錄入新圖書界面 :還有各個功能各種界面,這里就不一一列出了。五、 實訓心得與體會此次系統(tǒng)編程,我感受很多,從開始編程時的迷茫,到修改時的煩躁,再到運行時的無奈,最后是成功時無法表達的喜悅和興奮。每一步都是自己努力走過來的,雖然這個過程比較辛苦,但是現(xiàn)在回過頭去想想,這幾天還是過得很有意義和價值的。大家都說編程最需要的是耐心,我這次是深有體會,程序剛開始編,滿身都是信心和興趣,到修改的時候,檢查一遍又一遍,修改一次有一次還是無法成功運行,這個時候只有耐心才能堅持完成。同時,編程時,會發(fā)現(xiàn)許多以前學的概念都記錯了,這時候

8、要找出課本重新溫習,所以這也是一個不斷學習的過程。還有,編程時不能太死板,要實現(xiàn)一個功能其實都會有很多種算法,我們應邊做邊學習新的方法。對于我的不足之處,要實現(xiàn)一個功能時,我總是第一遍編程實現(xiàn)后,就不愿意在深探究下去,這種惰性很不適合做編程工作??偠灾?,通過此次c語言實踐編程,使我對c語言的興趣更加濃厚,也對c語言的實踐應用更加了解,充分感受到了它的魅力,同時也明白了自身在這方面工作的優(yōu)勢和不足。六、 附錄#include#include#includestruct tushu char bianhao110; char bianhao210; char leixing20; char sh

9、uming50; char chubanshe50; char writer20; long zongshu; long shengyu; shu;struct books char bianhao110; char bianhao210; long nian; long borrowmonth; long borrowday; long returnedmonth; long returnedday; long limittime; char student10; book;void shan() /刪除圖書信息 file *fp; int i=0,j,n,m,l; char booknum

10、20; struct tushu tu1000; if(fp=fopen(tushu.txt,r)=null) printf(can not open the tushu.txt.n); exit(0); while(fread(&tui,sizeof(shu),1,fp) i+; m=i; printf(要刪除幾本書:); scanf(%d,&n); getchar(); for(i=0;in;i+) printf(輸入圖書編號2:); gets(booknum); for(j=0;jm;j+) if(strcmp(booknum,tuj.bianhao2)=0) break; if(jm)

11、for(l=0;lm;l+)if(strcmp(tuj.bianhao1,tul.bianhao1)=0)tul.zongshu-; tul.shengyu-; for(j;jm;j+) tuj=tuj+1; else printf(輸入有誤 重新輸入n); i-; if(fp=fopen(tushu.txt,w)=null) printf(can not open the tushu.txt.n); exit(0); for(i=0;im-n;i+) fwrite(&tui,sizeof(shu),1,fp);printf(刪除成功!);void xiu() /修改圖書信息 file *fp

12、; int i=0,m,n; char booknum20,numchar20; struct tushu tu1000; if(fp=fopen(tushu.txt,r)=null) printf(can not open the borrow.txt.n); exit(0); while(fread(&tui,sizeof(shu),1,fp) i+; m=i; if(fp=fopen(tushu.txt,w)=null) printf(can not open the borrow.txt.n); exit(0); printf(要修改幾本書:); scanf(%d,&n); getch

13、ar(); for(i=0;in;i+) printf(輸入要修改的圖書編號2:); gets(booknum); for(i=0;im;i+) if(strcmp(booknum,tui.bianhao2)=0) break; if(im) printf(輸入修改后的nn); printf(輸入編號1:); gets(tui.bianhao1);printf(n); printf(編號2:); gets(tui.bianhao2);printf(n); printf(類型:); gets(tui.leixing);printf(n); printf(書名:); gets(tui.shumin

14、g);printf(n); printf(出版社:); gets(tui.chubanshe);printf(n); printf(作者:); gets(tui.writer);printf(n); printf(總數(shù):); gets(numchar);printf(n); tui.zongshu=atol(numchar); printf(剩余:); gets(numchar);printf(n); tui.shengyu=atol(numchar); else printf(輸入有誤n); for(i=0;im;i+) fwrite(&tui,sizeof(shu),1,fp); fclo

15、se(fp);void putin() /錄入新圖書 char numchar20; file *fp; int i=0,m,n; struct tushu tu1000; if(fp=fopen(tushu.txt,r)=null) printf(can not open the borrow.txt.n); exit(0); while(fread(&tui,sizeof(shu),1,fp) i+; m=i; if(fp=fopen(tushu.txt,w)=null) printf(can not open the borrow.txt.n); exit(0); for(i=0;im;

16、i+) fwrite(&tui,sizeof(shu),1,fp); printf(要錄入幾本書:); scanf(%d,&n); getchar(); for(i=0;in;i+) printf(n); printf(輸入編號1:); gets(shu.bianhao1); printf(n); printf(編號2:); gets(shu.bianhao2); printf(n); printf(類型:); gets(shu.leixing); printf(n); printf(書名:); gets(shu.shuming); printf(n); printf(出版社:); gets(

17、shu.chubanshe); printf(n); printf(作者:); gets(shu.writer); printf(n); printf(總數(shù):); gets(numchar); printf(n); shu.zongshu=atol(numchar); printf(剩余:); gets(numchar); printf(n); shu.shengyu=atol(numchar); fwrite(&shu,sizeof(shu),1,fp); fclose(fp);void print() /打印圖書信息表 file *fp; if(fp=fopen(tushu.txt,r)=

18、null) printf(can not open the tushu.txt.n); exit(0); puts(_); puts(-); puts(| 編號1 | 編號2 | 類型 | 書名 | 作者 | 出版社 | 總數(shù) | 剩余 |); fseek(fp,0l,seek_set); while(fread(&shu,sizeof(shu),1,fp)=1) printf( %-9s%-10s%-10s%-10s%-10s%-10s%-10ld%-10ldn,shu.bianhao1,shu.bianhao2,shu.leixing,shu.shuming,shu.writer,shu.

19、chubanshe,shu.zongshu,shu.shengyu);void returned() /還書 file *fp; int i=0,m,flag=0,j; char booknum20; struct books book11000; if(fp=fopen(borrow.txt,r)=null) printf(can not open the borrow.txt.n); exit(0); while(fread(&book1i,sizeof(book),1,fp) i+; m=i; if(fp=fopen(borrow.txt,w)=null) printf(can not

20、open the borrow.txt.n); exit(0); printf(輸入要還的圖書編號2:); gets(booknum); for(j=0;jm;j+) if(strcmp(booknum,book1j.bianhao2)=0)flag=1; break; if(flag) flag=0; printf(輸入還書月份:); scanf(%ld,&book1i.returnedmonth); printf(輸入還書日期:); scanf(%ld,&book1i.returnedday); getchar(); for(j=0;jm;j+)fwrite(&book1i,sizeof(

21、book),1,fp); elseprintf(輸入有誤n); fclose(fp);void books() /創(chuàng)建圖書文件 file *fp; char numchar50,ch=y; if(fp=fopen(tushu.txt,wt)=null) printf(can not open the tushu.txt.n); exit(0); while(ch=y|ch=y) printf(n); printf(輸入編號1:); gets(shu.bianhao1); printf(n); printf(編號2:); gets(shu.bianhao2); printf(n); printf

22、(類型:); gets(shu.leixing); printf(n); printf(書名:); gets(shu.shuming); printf(n); printf(出版社:); gets(shu.chubanshe); printf(n); printf(作者:); gets(shu.writer); printf(n); printf(總數(shù):); gets(numchar); printf(n); shu.zongshu=atol(numchar); printf(剩余:); gets(numchar); printf(n); shu.shengyu=atol(numchar);

23、fwrite(&shu,sizeof(shu),1,fp); do printf(have another book record(y/n)?:); gets(numchar); ch=numchar0; while(!(ch=y|ch=n|ch=y|ch=n); fclose(fp);void borrowed() /借書 struct tushu tu1000; struct books book11000; file *fp,*fq; char numchar50; int i=0,j,m1,m2,n,flag=0,x;printf(借幾本書:);scanf(%d,&x);getchar

24、(); if(fq=fopen(tushu.txt,r)=null)printf(can not open the tushu.txt.n); exit(0); while(fread(&tui,sizeof(shu),1,fq)i+; m1=i; if(fp=fopen(borrow.txt,r)=null) printf(can not open the borrow.txt.n); exit(0); while(fread(&book1i,sizeof(book),1,fp) i+; m2=i; for(i=0;ix;i+)printf(n);printf(輸入編號2:); gets(n

25、umchar); for(j=0;jm1;j+)if(strcmp(numchar,tuj.bianhao2)=0)n=j;flag=1; break; if(flag)printf(n);printf(輸入正確nn);flag=0;strcpy(book.bianhao2,numchar);printf(輸入編號1); gets(book.bianhao1); printf(n); printf(借書年份:); gets(numchar); printf(n); book.nian=atol(numchar); printf(借書月份:); gets(numchar); printf(n);

26、 book.borrowmonth=atol(numchar); printf(借書日期:); gets(numchar); printf(n); book.borrowday=atol(numchar); printf(還書月份:); gets(numchar); printf(n); book.returnedmonth=atol(numchar); printf(還書日期:); gets(numchar); printf(n); book.returnedday=atol(numchar); printf(期限:); gets(numchar); printf(n); book.limi

27、ttime=atol(numchar); printf(學生學號:); gets(book.student); printf(n); if(fp=fopen(borrow.txt,w)=null)printf(can not open the borrow.txt.n); exit(0);fwrite(&book,sizeof(book),1,fp); for(j=0;jm2;j+)fwrite(&book1j,sizeof(book),1,fp);for(j=0;jm1;j+)if(strcmp(tun.bianhao1,tuj.bianhao1)=0)tuj.shengyu-; if(fq=fopen(tushu.txt,w)=null)printf(can not open the tushu.txt.n); exit(0);for(j=0;jm1;j

溫馨提示

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

評論

0/150

提交評論