小型圖書管理系統(tǒng)C語言課程設(shè)計報告_第1頁
小型圖書管理系統(tǒng)C語言課程設(shè)計報告_第2頁
小型圖書管理系統(tǒng)C語言課程設(shè)計報告_第3頁
小型圖書管理系統(tǒng)C語言課程設(shè)計報告_第4頁
小型圖書管理系統(tǒng)C語言課程設(shè)計報告_第5頁
已閱讀5頁,還剩14頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、德州學院計算機系課程設(shè)計報告實習名稱 數(shù)據(jù)結(jié)構(gòu) 設(shè)計題目 小型圖書管理系統(tǒng) 實習時間 2011.1.3-2011.1.9 專業(yè)班級 2009級網(wǎng)絡(luò)工程 指導老師 徐志敏 教學單位(蓋章) 小組分工情況:學號姓名分工2劉偉插入排序存檔程序編寫、報告撰寫2孟學文刪除查找修改程序編寫、報告撰寫二0一一年一月九日課程設(shè)計報告正文內(nèi)容及格式要求:1、正文部分主要包括:選題背景、論點或方案論證、過程(設(shè)計或?qū)嶒?論述、結(jié)果分析、結(jié)論或總結(jié)。2、標題:題目用小二號黑體字(加黑),居中;副標題用三號黑體字,緊挨正標題下居中,文字前加破折號。英文題目為18磅加粗Times New Roman字,副標題為16磅加

2、粗Times New Roman字。3、課程設(shè)計報告格式要求:一級標題用小三號黑體字;二級標題用四號黑體字;三級標題用小四號黑體字;正文用宋體小四號字(英文用12磅Times New Roman字),采用1.5倍行距,標準字符間距:頁碼一律用小5號字標明。4、課程設(shè)計報告撰寫要求:(1)文字通順,語言流暢,能將設(shè)計過程表述清楚。(2)圖表整潔,布局合理,須按國家規(guī)定的繪圖標準繪制。 (3)報告字數(shù)不少于3千字。小型圖書管理系統(tǒng)一、選題背景在學習了數(shù)據(jù)結(jié)構(gòu)課本理論知識后,為了檢驗自己所學知識的牢固性,鞏固大家的理論知識,調(diào)動大家的編程興趣;同時為大家提供一個實踐自己,檢驗自己的平臺,以增加大家對

3、將來工作的適應(yīng)能力;也為了鍛煉大家的動手實踐能力,遂在學期末進行了本次課程設(shè)計?!皵?shù)據(jù)結(jié)構(gòu)”在計算機科學中是一門綜合性的專業(yè)基礎(chǔ)課?!皵?shù)據(jù)結(jié)構(gòu)”的研究不僅涉及到計算機硬件的研究范圍,而且和計算機軟件的研究有著密切的關(guān)系,無論是編譯程序還是操作系統(tǒng),都涉及到數(shù)據(jù)元素在存儲器中的分配問題。在研究信息檢索時也必須考慮如何組織數(shù)據(jù),以便查找和存取數(shù)據(jù)元素更為方便。因此,可以認為“數(shù)據(jù)結(jié)構(gòu)”是介于數(shù)學、計算機硬件和計算機軟件三者之間的一門核心課程。在計算機科學中,“數(shù)據(jù)結(jié)構(gòu)”不僅是一般程序設(shè)計的基礎(chǔ),而且是設(shè)計和實現(xiàn)編譯程序、操作系統(tǒng)、數(shù)據(jù)庫系統(tǒng)及其他系統(tǒng)程序和大型應(yīng)用程序的重要基礎(chǔ)。我們本著自己的興趣

4、及挑戰(zhàn)自己的態(tài)度,也為檢驗我們理論知識的熟練度,鍛煉我們動手實踐能力,我們選擇了小型圖書管理系統(tǒng)的編寫。因為我們生活在大學,圖書館是我們學習的天堂,借書和還書又是必不可少的,一個好的圖書管理系統(tǒng)對于我們學生和管理人員都會為大家提供很多便利。本著挑戰(zhàn)和創(chuàng)新的思想,我們進行了此次課程設(shè)計程序編寫及報告撰寫。二、運行環(huán)境(軟、硬件環(huán)境) 預裝了Windows XP操作系統(tǒng)的PC機、 Microsoft Visual C+ 6.0版編輯器。三、算法設(shè)計的思想通過對圖書管理系統(tǒng)內(nèi)的圖書進行添加和刪除操作,實現(xiàn)同學借書和還書的記錄工作,通過對圖書的查找和按指定方式排序,更有利于同學們挑選自己所需要的圖書,

5、借閱借書所需時間。同時,通過按需要的條件排序,也有助于圖書管理人員更加方便快捷的管理全部書庫圖書信息。遍歷查找和插入排序的功能,以及其它所有的算法操作都是為了方便快捷的利用圖書館資源,更大化的優(yōu)化操作流程和更好體現(xiàn)人機一體話的概念。設(shè)計程序框架圖:四、算法的流程圖五、算法設(shè)計分析定義圖書結(jié)構(gòu)體struct book結(jié)構(gòu)體內(nèi)容:定義作者、書名、出版社、書號數(shù)組及浮點型價格數(shù)據(jù)。 char writer20;/作者/ char title20;/書名/ char publishinghouse20;/出版社/ char number10;/書號/ float price;/價格/ struct b

6、ook * next;定義書庫的結(jié)構(gòu)體指針:struct book * Create_Book();插入圖書信息:void Insert(struct book * head);刪除圖書信息:void Delete(struct book * head);刷新顯示書庫信息:void Print_Book(struct book * head);查找數(shù)目:void search_book(struct book * head);更改圖書信息:void change_Book(struct book * head);對數(shù)據(jù)進行保存工作void save(struct book * head);六、

7、源代碼#include<stdio.h>#include<string.h>#include<stdlib.h>struct book char writer20; char title20; char publishinghouse20; char number10; float price; struct book * next;struct book * Create_Book();void Insert(struct book * head);void Delete(struct book * head);void Print_Book(struct

8、 book * head);void search_book(struct book * head);void change_Book(struct book * head);void save(struct book * head);struct book * Create_Book()struct book * head;head=(struct book *)malloc(sizeof(struct book);head->next=NULL;return head;void save(struct book * head)struct book *p;FILE *fp;p=hea

9、d;fp=fopen("kucun.txt","w+");fprintf(fp,"*n");fprintf(fp,"書號t 書名t 作者t 出版社t 價格t n"); fprintf(fp," n");while(p->next!= NULL)p=p->next;fprintf(fp,"%st %st %st %st %.2ft n",p->number,p->title,p->writer,p->publishinghouse,p->

10、;price);fprintf(fp,"*n");fclose(fp);printf(" 已將圖書數(shù)據(jù)保存到 kucun.txt 文件n");/插入/void Insert(struct book *head) struct book *s, *p,*p1,*swap; char flag='Y' swap=(struct book *)malloc(sizeof(struct book); p1=swap; p=head; while(flag='Y'|flag='y') s=(struct book *

11、)malloc(sizeof(struct book); printf("n 請輸入圖書書號:"); fflush(stdin); scanf("%s",s->number); printf("n 請輸入圖書書名:"); fflush(stdin); scanf("%s",s->title); printf("n 請輸入圖書作者名:"); fflush(stdin); scanf("%s",s->writer); printf("n 請輸入圖書出版

12、社:"); fflush(stdin); scanf("%s",s->publishinghouse); printf("n 請輸入圖書價格:"); fflush(stdin); scanf("%f",&s->price); printf("n");/排序/ p1=p->next; if(head->next!=NULL) do if(strcmp(p1->number),(s->number)>0) strcpy(swap->number,p1-&

13、gt;number); strcpy(swap->title,p1->title); strcpy(swap->writer,p1->writer); strcpy(swap->publishinghouse,p1->publishinghouse); swap->price=p1->price; strcpy(p1->number,s->number); strcpy(p1->title,s->title); strcpy(p1->writer,s->writer); strcpy(p1->publis

14、hinghouse,s->publishinghouse); p1->price=s->price; strcpy(s->number,swap->number); strcpy(s->title,swap->title); strcpy(s->writer,swap->writer); strcpy(s->publishinghouse,swap->publishinghouse); s->price=swap->price; p=p1; p1=p->next; while(p1!=NULL); p->

15、next=s; s->next=NULL; printf(" * 添加成功!*"); printf("n 繼續(xù)添加?(Y/N):"); fflush(stdin); scanf("%c",&flag); printf("n"); if(flag='N'|flag='n') break; else if(flag='Y'|flag='y') continue; save(head);/查找/void search_book(struct b

16、ook *head) struct book * p; char temp20; p=head; if(head=NULL | head->next=NULL) printf(" * 圖書庫為空!*n"); else printf("請輸入您要查找的書名: "); fflush(stdin); scanf("%s",temp); while(p->next!= NULL) p=p->next; if(strcmp(p->title,temp)=0) printf("n圖書已找到!n"); p

17、rintf("n"); printf("書號: %stn",p->number); printf("書名: %stn",p->title); printf("作者名: %stn",p->writer); printf("出版社: %stn",p->publishinghouse); printf("價格: %.2ftn",p->price); if(p->next=NULL) printf("n查詢完畢!n"); voi

18、d Print_Book(struct book * head) struct book * p; if(head=NULL | head->next=NULL) printf("n * 沒有圖書記錄! *nn"); p=head; printf("*n"); printf(" 書號t書名t作者t出版社t價格tn"); printf("*n"); while(p->next!= NULL) p=p->next; printf("%st%st%st%st%.2ftn",p->

19、;number,p->title,p->writer,p->publishinghouse,p->price); printf("*n"); printf("n");/更改/void change_Book(struct book * head)struct book * p;int panduan=0;char temp20;p=head;printf("請輸入要修改圖書的書號:");scanf("%s",temp);while(p->next!= NULL)p=p->next

20、;if(strcmp(p->number,temp)=0) printf("n 請輸入圖書書名:"); fflush(stdin); scanf("%s",p->title); printf("n 請輸入圖書作者名:"); fflush(stdin); scanf("%s",p->writer); printf("n 請輸入圖書出版社:"); fflush(stdin); scanf("%s",p->publishinghouse); printf(&

21、quot;n 請輸入圖書價格:"); fflush(stdin); scanf("%f",&p->price); printf("n"); panduan=1; if(panduan=0) printf(" n*沒有圖書記錄!*nn");/刪除/void Delete(struct book *head) struct book *s,*p; char temp20; int panduan; panduan=0; p=s=head; printf(" 請輸入您要刪除的書名:"); scan

22、f("%s",temp); p=p->next; while(p!= NULL) if(strcmp(p->title,temp)=0) panduan=1; break; p=p->next; if(panduan=1) while(s->next!=p) s=s->next; s->next=p->next; free(p); printf("n * 刪除成功!*n"); save(head); else printf(" 您輸入的書目不存在,請確認后輸入!n"); /主函數(shù)/void m

23、ain() struct book * head; int choice; head=NULL; while(1) printf(" *n"); printf(" * 小型圖書管理系統(tǒng) *n"); printf(" * *n"); printf(" * 1圖書信息錄入 *n"); printf(" * *n"); printf(" * 2圖書信息瀏覽 *n"); printf(" * *n"); printf(" * 3圖書信息查詢 *n&quo

24、t;); printf(" * *n"); printf(" * 4圖書信息修改 *n"); printf(" * *n"); printf(" * 5圖書信息刪除 *n"); printf(" * *n"); printf(" * 6退出系統(tǒng) *n"); printf(" *n"); printf(" 請選擇:"); fflush(stdin); scanf("%d",&choice); switch (c

25、hoice) case 1: if(head=NULL) head=Create_Book(); Insert(head); break; case 2: Print_Book(head); break; case 3: search_book(head); break; case 4: change_Book(head); break; case 5: Delete(head); break; case 6: printf("n"); printf(" * 感謝使用圖書管理系統(tǒng) *n"); break; default: printf(" *

26、 輸入錯誤,請重新輸入!*"); break; 七、運行結(jié)果分析主界面:顯示提示操作信息,按提示信息進行操作,方便操作管理。添加信息頁面:在主界面選擇1,分書號、書名等條目添加圖書信息,存檔到書庫,便于用戶查找和管理員管理所有圖書。在一次添加完成后可以根據(jù)提示進行繼續(xù)添加圖書信息到書庫。查詢庫存所需圖書信息:在主界面選擇3,根據(jù)書名,從書庫中直接調(diào)用所查找圖書的全部信息。顯示瀏覽庫存圖書信息(排序功能):按提示操作在主界面選擇2,展示現(xiàn)在書庫中所有圖書信息,并按書號大小排序,一目了然。更改庫存圖書信息:在主界面選擇4,對圖書信息進行更改、存檔,更改后圖書信息將覆蓋原來圖書信息并存檔。并在修改完成后,在主界面選擇2,顯示更改后現(xiàn)存圖書信息。 在庫存中刪除外借圖書信息:在主界面選擇5,從書庫中直接刪除外借圖書,并做存檔kucun.txt文件工作。圖書存檔txt文件:圖書信息自動存檔txt文件,方便借閱人

溫馨提示

  • 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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論