收藏 分销(赏)

数据结构专业课程设计.doc

上传人:快乐****生活 文档编号:2683457 上传时间:2024-06-04 格式:DOC 页数:30 大小:51.04KB
下载 相关 举报
数据结构专业课程设计.doc_第1页
第1页 / 共30页
数据结构专业课程设计.doc_第2页
第2页 / 共30页
数据结构专业课程设计.doc_第3页
第3页 / 共30页
数据结构专业课程设计.doc_第4页
第4页 / 共30页
数据结构专业课程设计.doc_第5页
第5页 / 共30页
点击查看更多>>
资源描述

1、数据结构课程设计计算机科学和技术级1班课程设计题目:图书借阅管理系统姓名:学号:一需求分析说明图书借阅处理过程简述处理过程关键包含:新增图书上架、办理图证、图书查询、借书、还书等。(1)新增图书上架新书上架时,需要登记新书:书名、作者、出版社、总册数信息。(2)办理图书借阅证读者办理借书证时,需要登记读者(学生)学号、姓名。(3)图书查询读者根据图书编号查询图书基础信息,并能够得悉现还有几册能够借阅。(4)借书每个学生读者最多借本书。读者借书时,应登记书号、借书日期(年月日)。2数据分析数据处理过程中包含到两个实体:图书和会员;各实体应含有属性以下:图书(书号、书名、作者,总册数)读者(学号、

2、姓名、班级)因为同一个图书能够有多册上架,每个读者最多能够借阅本书,图书借阅属性以下:借阅(书号、借书日期)3功效分析系统功效模块包含:图书增加、图书删除、图书查询、借书、还书;另外还包含图书信息修改和读者信息修改。二基础功效1)图书管理(增加图书、查询图书、删除图书、图书借阅、还书);2)会员管理(增加会员、查询会员、删除会员、借书信息);3)系统管理(初始化、载入数据、保留数据、退出程序);三程序设计#include#include#include#define NULL 0 typedef struct BookInfo /图书结构 int b_Code; /图书编号 char b_Na

3、me20; /名称 int b_Total; /总数 int b_Out; /借出数 BookInfo* nextbook; /下一类图书BookInfo; typedef struct MemberInfo /会员结构 long m_Code; /会员编号 char m_Name20; /会员名字 int l_Codes6; /以借书编号,最多5 MemberInfo* nextmember; /下一会员MemberInfo; typedef struct System /管理系统结构 BookInfo* BI; MemberInfo* MI; int BookTotal; /图书类库存量

4、int MemberTota; /会员数量System; System* InitSystem();/void AddBook(System*);/增加图书BookInfo* SearchBook(System*,int);/查询图书信息 void DelBook(System*);/删除图书 void BrrowBook(System*);/借书处理void TurnBackBook(System*);/还书处理 void AddMember(System*);/添加会员void DelMember(System*);/删除会员MemberInfo* SearchMember(System*

5、,int);/查询会员信息 void StoreData(System*); void LoadData(System*);void ExitSystem();void main() System* S=InitSystem(); int sel; do coutntttt图书管理系统endl; coutttt*endl; coutttt*endl; coutttt 1.增加图书.t 2.查询图书.nttt 3.删除图书.t 4.借书处理.nttt 5.还书处理.nttt 6.添加会员.t 7.删除会员.nttt 8.查询会员.t 9.载入数据.nttt10.保留数据.t11.退出程序.n;

6、coutttt*endl; coutttt*endl; coutsel; if(sel=1&sel=11)break; cout选择错误!n重新输入:BI=(BookInfo*)malloc(sizeof(BookInfo); S-BookTotal=0; S-BI-nextbook=NULL; S-MI=(MemberInfo*)malloc(sizeof(MemberInfo); S-MemberTota=0; S-MI-nextmember=NULL; return S;void AddBook(System* S) int Tempcode; char sel; BookInfo* p

7、=S-BI; BookInfo* t; BookInfo* m; int num; do coutTempcode; if(m=SearchBook(S,Tempcode) cout这类书以有库存.n输入图书入库量:num; m-b_Total+=num; else t=(BookInfo*)malloc(sizeof(BookInfo); t-b_Code=Tempcode; coutt-b_Name; coutt-b_Total; t-b_Out=0; t-nextbook=p-nextbook; p-nextbook=t; S-BookTotal+; cout添加完成!endl; cou

8、tsel; if(sel=n|sel=N) cout结束添加BI-nextbook; int bookcode; if(code=-1) coutbookcode; else bookcode=code; while(bi&bi-b_Code!=bookcode)bi=bi-nextbook; if(code=-1) if(!bi)cout没找到你所要图书.endl; else cout图书编号为:b_Codeendl; cout图书名称为:b_Nameendl; cout图书库存量为:b_Totalendl; cout图书借出量为:b_OutBI; MemberInfo* memi; cha

9、r sel; int tempcode; int i; do pl=S-BI; bi=pl-nextbook; memi=S-MI-nextmember; couttempcode; while(bi) if(bi-b_Code=tempcode)break; pl=bi; bi=bi-nextbook; if(bi=0)cout没有找到要删除图书nextbook=bi-nextbook; S-BookTotal-; while(memi) for(i=1;il_Codes0;i+) if(memi-l_Codesi=tempcode)break; if(il_Codes0) for(;il_

10、Codes0;i+)memi-l_Codesi=memi-l_Codesi+1; memi-l_Codes0-; memi=memi-nextmember; free(bi); coutsel; if(sel=N|sel=n) cout删除图书结束BI-nextbook; BookInfo* p; char sel; int memcode; MemberInfo* mp; int tempcode; do couttempcode; p=SearchBook(S,tempcode); if(!p) cout没有找到要借出图书.endl; else cout此书现存量为b_Total-p-b_

11、Out)b_Total-p-b_Out)cout没有足够书了,外借失败.endl; else coutmemcode; mp=SearchMember(S,memcode); if(!mp)cout会员编号输入错误,外借失败l_Codes0=5)coutb_Out+; mp-l_Codes+mp-l_Codes0=tempcode; cout外借成功.endl; coutsel; if(sel=N|sel=n) cout外借操作结束.BI-nextbook; BookInfo* p; MemberInfo* mp; int membercode; int tempcode; int i; ch

12、ar sel; do couttempcode; p=SearchBook(S,tempcode); if(!p) cout书号输入错误.endl; else cout此书现存量为b_Total-p-b_Out)endl; coutmembercode; if(!(mp=SearchMember(S,membercode)cout会员编号输入错误,归还失败b_Out-; for(i=1;il_Codes0;i+) if(mp-l_Codesi=tempcode)break; while(il_Codes0) mp-l_Codesi=mp-l_Codesi+1; i+; mp-l_Codes0-

13、; cout归还成功.endl; coutsel; if(sel=N|sel=n) cout归还结束.MI; MemberInfo* t; do coutTempcode; t=(MemberInfo*)malloc(sizeof(MemberInfo); t-m_Code=Tempcode; coutt-m_Name; t-l_Codes0=0; t-nextmember=p-nextmember; p-nextmember=t; S-MemberTota+; cout添加完成!endl; coutsel; if(sel=n|sel=N) cout结束添加MI-nextmember; int

14、 membercode; int i; if(code=-1) coutmembercode; else membercode=code; while(bi&bi-m_Code!=membercode)bi=bi-nextmember; if(code=-1) if(!bi)cout没找到指定会员.endl; else cout会员编号为:m_Codeendl; cout名称为:m_Nameendl; cout已借图书有:l_Codes0本.endl; for(i=1;il_Codes0;i+) coutl_Codesi ; coutMI-nextmember; pl=S-MI; coutte

15、mpcode; while(bi) if(bi-m_Code=tempcode)break; pl=bi; bi=bi-nextmember; if(!bi)coutnextmember=bi-nextmember; S-MemberTota-; for(i=1;il_Codes0;i+) if(!(book=SearchBook(S,bi-l_Codesi) cout删除会员犯错!b_Out-; book-b_Total-; free(bi); coutsel; if(sel=N|sel=n) cout删除会员结束BI-nextbook; if(!(fp=fopen(BookSys,wb)

16、cout打开文件BookSys失败!BookTotal),sizeof(int),1,fp); while(bi) fwrite(bi,sizeof(BookInfo),1,fp); bi=bi-nextbook; MemberInfo* mi=S-MI-nextmember; fwrite(&(S-MemberTota),sizeof(int),1,fp); while(mi) fwrite(mi,sizeof(MemberInfo),1,fp); mi=mi-nextmember; fclose(fp); void LoadData(System* S) FILE* fp; if(!(fp

17、=fopen(BookSys,rb) cout打开文件BookSys失败BI; BookInfo* tempbi; fread(&(S-BookTotal),sizeof(int),1,fp); for(int i=1;iBookTotal;i+) tempbi=(BookInfo*)malloc(sizeof(BookInfo); fread(tempbi,sizeof(BookInfo),1,fp); bi-nextbook=tempbi; bi=tempbi; bi-nextbook=NULL; MemberInfo* mi=S-MI; MemberInfo* tempmi; fread

18、(&(S-MemberTota),sizeof(int),1,fp); for(i=1;iMemberTota;i+) tempmi=(MemberInfo*)malloc(sizeof(MemberInfo); fread(tempmi,sizeof(MemberInfo),1,fp); mi-nextmember=tempmi; mi=tempmi; mi-nextmember=NULL; fclose(fp);void ExitSystem() char select; cout警告: 程序结束后未存放数据将消失.endl; coutselect; if(select=y|select=

19、Y)exit(0); if(select=n|select=N)return;四心得体会历经大半个学期努力,我图书管理系统最终准期完成了。此次做系统给我最大感慨有两个。第一个就是有了一个利用本专业所学到知识,来练习,实践机会。 第二个就是增强了自己自信心。 经过进行图书借阅管理系统设计,深入明确了研制一个管理信息系统方法和思绪,将系统开发各阶段基础活动贯穿起来,使我愈加形象、具体了解了管理信息系统。系统开发过程是一个巩固以前所学计算机知识,掌握新技能过程。我从这一阶段工作中收益非浅,经过前段时间课程设计,我能够融会贯通所学专业基础知识和专业理论知识,培养我们综合利用专业知识分析问题、处理问题能力及利用工具软件能力。不仅搞清了以前对系统开发部分模糊认识,而且提升了写代码水平,培养了严谨工作作风,为以后在工作岗位上用好管好计算机打下了坚实基础。 在做系统过程中,我碰到最大困难是调程序方面。在运行程序过程中常常会出现程序自行中止,需要进行调试信息。这些信息使得我不得不反复看书,琢磨程序。在一遍一遍调试之下,程序最终被调通了。那时,我最终能够上上舒一口气了。 我系统规模比较小同时因为我时间和能力等多方面原因影响,我们系统也存在一定缺点。

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 学术论文 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服