欢迎来到三一文库! | 帮助中心 三一文库31doc.com 一个上传文档投稿赚钱的网站
三一文库
全部分类
  • 研究报告>
  • 工作总结>
  • 合同范本>
  • 心得体会>
  • 工作报告>
  • 党团相关>
  • 幼儿/小学教育>
  • 高等教育>
  • 经济/贸易/财会>
  • 建筑/环境>
  • 金融/证券>
  • 医学/心理学>
  • ImageVerifierCode 换一换
    首页 三一文库 > 资源分类 > DOC文档下载  

    图书馆管理系统(Library management system).doc

    • 资源ID:11228590       资源大小:28.33KB        全文页数:42页
    • 资源格式: DOC        下载积分:6
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录   微博登录  
    二维码
    微信扫一扫登录
    下载资源需要6
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    图书馆管理系统(Library management system).doc

    图书馆管理系统(Library management system)#包括< stdio. h >#包括<字符串。”#包括<<程序。”#包括<是>。H#定义马克斯3typedef struct的书焦book_num 10 ;/图书编号焦book_name 20 ;/图书名称焦book_writer 10 ;/作者国际book_zonggong_;/ /总共册数国际book_zaiguan_;/ /在馆册数下一本书; BK;typedef struct借焦borrow_book_num 10 ;焦huanshu_date 8 ; BW;typedef struct的读者焦reader_num 10 ;焦reader_name 10 ;国际zuida;BW借用最大;下一个读取器结构;路;* h_book BK;路* h_reader;国际menu();/ * * /主菜单无效menu_select_book();无效();/*初始化*/无效init_reader();无效init_book();无效insert_new_book();/ * * /新书入库无效select_book();无效borrow_book();无效return_book();无效save();/ * * /保存信息无效save_reader();无效save_book();无效();无效load_reader();/ * * /加载读者信息无效load_book();无效modify_booklist();无效show_allbook();无效show_reader();无效delete_book();无效()/ * * /初始化 printf(“* n”);printf(“n本系统第一次使用需要对图书信息和读写信息进行初始化n”);init_reader();init_book();无效init_reader() / * * /注册读者信息路* P0;int i;printf(“n现在请对读写信息进行注册n”);P0 =(RD *)malloc(sizeof(RD);h_reader = P0;printf(“请输入读者的信息:n”);printf(“读者图书证号:”);scanf(“%s”,P0 -> reader_num);printf(“读者姓名:”);scanf(“%s”,P0 -> reader_name);P0 -> zuida = 0;为(i = 0;i < <马克斯;我+ +)strcpy(P0 ->借我。borrow_book_num,“0”);/*所借图书直接置为0(即没有借书)* /strcpy(P0 ->借我。huanshu_date,“0”);P0 ->下= null;printf(“n注册完毕!按任意键继续下一步操作. n”);printf(“* n”);getch();无效init_book() / * * /初始化图书信息BKP =(BK *)malloc(sizeof(BK);焦的我;printf(“n现在请对读写信息进行初始化n”);h_book = P;printf(“请输入图书信息:n”);做BKP0 =(BK *)malloc(sizeof(BK);P >下= P0;下一页;printf(“图书编号:”);scanf(“%s”,P0 -> book_num);printf(“图书名称:”);scanf(“%s”,P0 -> book_name);printf(“图书作者:”);scanf(“%s”,P0 -> book_writer);printf(“图书数量:”);scanf(“%d”,与P0 -> book_zonggong_);P0->book_zaiguan_=p0->book_zonggong_; / * start in the Museum Library and the total number of equal volumes.P0->next=NULL;Printf ("whether to continue input? (y/n) n");Scanf ("%s", &i);/p0=p0->next;while (i=y);Printf ("n initialization is completed! Press any key to continue the next operation! n");Printf ("*n");Getch ();System ("CLS");Void (Save) / * * / save informationSave_Reader ();Save_Book ();Void (Save_Reader) / * * / save the reader informationFILE *fp_reader; / * * / create a file pointerRD *p, *p0;P=h_reader;If (fp_reader=fopen ("Reader.txt", "WB") =NULL) / * create a file, save.Printf ("n file failed to save! n, please restart this system. n");Exit (0);While (P! =NULL)If (fwrite (P, sizeof (RD), 1, fp_reader) =1 / *!) readers in the list information written to the file.Printf ("n write file failed! n, please restart this system! n");P0=p;P=p->next;Free (P0); / * * / release of all nodesH_reader=NULL;Fclose (fp_reader); / * * / close the fileVoid (Save_Book) / * * / save the book informationFILE *fp_book; / * * / create a file pointerBK *p, *p0;P=h_book;If (fp_book=fopen ("Book.txt", "WB") =NULL) / * create a file, save.Printf ("n file failed to save! n, please restart this system. n");Exit (0);While (P! =NULL)If (fwrite (P, sizeof (BK), 1, fp_book) =1 / *!) will list the information written to the file.Printf ("n write file failed! n, please restart this system! n");P0=p;P=p->next;Free (P0);H_book=NULL;Fclose (fp_book);Void (Load) / * * / loading the reader information and Book InformationLoad_Reader ();Load_Book ();Void (Load_Reader) / * * / loading the reader informationRD *p1, *p2, *p3;FILE *fp; / * * / create a file pointerFp=fopen ("Reader.txt", "RB"); / * * / open fileP1= (RD *) malloc (sizeof (RD);FREAD (P1, sizeof (RD), 1, FP);H_reader=p3=p2=p1;While (! Feof (FP) / * read the reader information, Re Chain into the list.p1= (RD *) malloc (sizeof (RD);FREAD (P1, sizeof (RD), 1, FP);P2->next=p1;P3=p2;P2=p1;P3->next=NULL;Free (P1);Fclose (FP); / * * / close the fileVoid (Load_Book) / * * / loading of book informationBK *p1, *p2, *p3;FILE *fp; / * * / create a file pointerFp=fopen ("Book.txt", "RB"); / * * / open fileP1= (BK *) malloc (sizeof (BK);FREAD (P1, sizeof (BK), 1, FP);H_book=p3=p2=p1;While (! Feof (FP) / * read information, Re Chain into the list.p1= (BK *) malloc (sizeof (BK);FREAD (P1, sizeof (BK), 1, FP);P2->next=p1;P3=p2;P2=p1;P3->next=NULL;Free (P1);Fclose (FP); / * * / close the file无效insert_new_book() / * * /新进图书BK *,* P1,* P2;P = P2 = h_book;printf(“n不请输入新书信息(包括书号、书名)n”);P1 =(BK *)malloc(sizeof(BK);printf(“不图书编号:”);scanf(“%s”,P1 -> book_num);而(strcmp(P1,P2 -> -> book_num,book_num)!= 0和下一个!= null)下一步;如果(strcmp(P1,P2 -> -> book_num,book_num)= = 0)/ *此处分两种情况,若图书编号存在,则直接入库,只须输入图书的数量*/printf(“n不你好,此编号的图书已存在,直接入库!“n);printf(“不图书数量:”);scanf(“%d”,与P1 -> book_zonggong_);book_zonggong_ + = P1 P2 -> -> book_zonggong_;book_zaiguan_ + = P1 P2 -> -> book_zonggong_;/ * * /开始时图书在馆册数和总共册数相等其他/ *若图书编号不存在,则需要输入图书的所有信息,然后再进行插入操作*/printf(“不图书名称:”);scanf(“%s”,P1 -> book_name);printf(“不图书作者:”);scanf(“%s”,P1 -> book_writer);printf(“不图书数量:”);scanf(“%d”,与P1 -> book_zonggong_);同时(p下)下一页;如果(h_book = = null)h_book = P1;/*此处分两种情况,链表中没有数据,头头指针直接指向P1处*/其他的P - >下= P1;/*链表中有数据,链表中最后元素的下指向P1处*/P1 =下一个null;book_zaiguan_ = P1 P1 -> -> book_zonggong_;printf(“n不新书入库完毕!按任意键继续下一步操作. n”);printf(“不- n”);getch();系统(“CLS”);无效delete_book() /删除 BKP = h_book ->下一步,*q = h_book;字符名称 10 ;如果(P!= null)printf(“请输入要删除的书名:”);scanf(“%s”,与名);而(P!= null && strcmp(Pbook_name,姓名)!= 0)q = P;下一页;如果(P!= null)/如果P此时不是最后一个节点,说明此时已经找到书下一步;printf(“删除成功!按任意键继续下一步操作. n”);printf(“不- n”);getch();系统(“CLS”);如果(P = = null)/如果P此时为最后一个结点并且没有找到与之相符的书名printf(“你输入的书名不存在,请核实后重新输入!“n);无效select_book() / * * /查找图书信息BK病毒;int c;焦book_num 10 ,book_name 20 ,book_writer 10 ;P = h_book;printf(“T1按书号查询:n”);printf(“T2按书名查询:n”);printf(“T3按作者名查询:n”);printf(“不请选择相应的操作(1-4):”);scanf(“%d”,& C);如果(C3 | | C1)printf(“不您的输入有误!”);scanf(“%d”,& C);开关(c)案例1:printf(“n不请输入你要查询的图书编号:”);scanf(“%s”,book_num);而(strcmp(Pbook_num,book_num)!= 0和p下一步)下一行;如果(strcmp(Pbook_num,book_num)= = 0)printf(“n不图书编号%s的信息为:n”,book_num);printf(“不图书编号图书名称图书作者在馆册数总共册数n”);printf(“t %s %s %s T T T %d %dn”,Pbook_num,Pbook_name,Pbook_writer,Pbook_zaiguan_,Pbook_zonggong_);其他的printf(“n不此图书不存在,请核对!”);printf(“n不新书入库完毕!按任意键继续下一步操作. n”);printf(“不- n”);getch();系统(“CLS”);打破;案例2:printf(“n不请输入你要查询的图书名称:”);scanf(“%s”,book_name);而(strcmp(Pbook_name,book_name)!= 0和p下一步)下一行;如果(strcmp(Pbook_name,book_name)= = 0)printf(“n不图书名称%s的信息为:n”,book_name);printf(“不图书编号图书名称图书作者在馆册数总共册数n”);printf(“t %s %s %s T T T %d %dn”,Pbook_num,Pbook_name,Pbook_writer,Pbook_zaiguan_,Pbook_zonggong_);其他的printf(“n不此图书不存在,请核对!”);printf(“n不新书入库完毕!按任意键继续下一步操作. n”);printf(“不- n”);getch();系统(“CLS”);打破;案例3:printf(“n不请输入你要查询图书的作者:”);scanf(“%s”,book_writer);而(strcmp(Pbook_writer,book_writer)!= 0和p下一步)下一行;如果(strcmp(Pbook_writer,book_writer)= = 0)printf(“n不图书名称%s的信息为:n”,book_writer);printf(“不图书编号图书名称图书作者在馆册数总共册数n”);printf(“t %s %s %s T T T %d %dn”,Pbook_num,Pbook_name,Pbook_writer,Pbook_zaiguan_,Pbook_zonggong_);其他的printf(“n不此图书不存在,请核对!”);printf(“n不新书入库完毕!按任意键继续下一步操作. n”);printf(“不- n”);getch();系统(“CLS”);打破;无效modify_book()BK病毒;/;P = h_book;焦book_num 10 ;printf(“n不请输入你要修改的图书编号:”);scanf(“%s”,book_num);而(strcmp(Pbook_num,book_num)!= 0和p下一步)下一行;如果(strcmp(Pbook_num,book_num)= = 0)printf(“不请输入修改后的信息!“n);printf(“n”);printf(“不图书编号图书名称图书作者在馆册数总共册数n”);scanf(“%s %s T T T T %d %s T %d”,普-> book_num,普-> book_name,普-> book_writer,普-> book_zaiguan_,普-> book_zonggong_);printf(“n不修改成功!按任意键继续下一步操作. n”);printf(“不- n”);getch();其他的printf(“不此编号的图书不存在”);无效borrow_book()BK;焦bo_num 20 ,reader_num 20 ,huan_date 8 ;int i;P1 = h_book;P2 = h_reader;printf(“n不借书INGn”);printf(“n不请输入借书的读者图书证号:”);scanf(“%s”,reader_num);当(下一个)!= null && strcmp(reader_num,P2 -> reader_num)!= 0)/ * * /遍历一次读者链表,判断读者是否存在下一步;如果(P2 ->下= = null && strcmp(reader_num,P2 -> reader_num)!= 0)/ *如果存在,则继续,不存在就提示错误!* /printf(“n不不好意思,此读者图书证号不存在!按任意键返回n”);去结束;其他的printf(“n不请输入你所借图书的编号:”);scanf(“%s”,bo_num);而(strcmp(bo_num,P1 -> book_num)!= 0和下一步!= null)/ * * /遍历一次图书链表,判断此图书是否存在下一步;如果(P1 ->下= = null && strcmp(bo_num,P1 -> book_num)!= 0)/ *如果存在,则继续,不存在就提示错误!* /printf(“n不不好意思,此图书编号不存在!按任意键返回n”);如果(P1 -> book_zaiguan_ <= 0)/ * * /判断此图书现在是否还有总共册数printf(“n不不好意思,此书已借完!请等待新书的到来!n按任意键返回的”);如果(P2 -> zuida > =马克斯)/ * * /判断此读者借书权限是否已达最大printf(“n不不好意思,借书数目已满!不能借书!按任意键返回的”);如果(strcmp(P2 ->借 0 。borrow_book_num,“0”)!= 0)/ * * /此读者若已经借书,再判断此读者是否要借两本一样的书为(i = 0;i <马克斯;i+)/ *遍历一次读者所借的书,如果发现有重复,则结束*/如果(strcmp(P2 ->借我。borrow_book_num,bo_num)= = 0)printf(“n不不好意思,!同一个读者不能同借两本相同的书!“n);如果(strcmp(P2 ->借我。borrow_book_num,”0“)= = 0)/ * * /如果没有重复,则继续printf(“n不请输入你要归还图书的日期例如(2001-02-21):”);scanf(“%s”,huan_date);strcpy(P2 ->借 P2 -> zuida + 。borrow_book_num,bo_num);/*记录读者所借图书书号,并且借书数目加一,现存量减一*/strcpy(P2 ->借 P2 -> zuida-1 。huanshu_date,huan_date);P1 -> book_zaiguan_ -;printf(“n不读者编号%s借书完毕!按任意键继续下步操作.”,P2 -> reader_num);突破;其他若此读者从未借过书/ * * /printf(“n不请输入你要归还图书的日期例如(2001-02-21):”);scanf(“%s”,huan_date);strcpy(P2 ->借 P2 -> zuida + 。borrow_book_num,bo_num);/*记录所借书号,并且借书数目加一,现存量减一*/strcpy(P2 ->借 P2 -> zuida-1 。huanshu_date,huan_date);P1 -> book_zaiguan_ -;printf(“n不读者编号%s借书完毕!按任意键继续下步操作.”,P2 -> reader_num);结束:getch();系统(“华彩”);无效return_book()BK;int,j,查找= 0;焦return_book_num 10 ,return_reader_num 10 ;P = h_book;Q = h_reader;printf(“n不还书INGn”);printf(“n不请输入要还书的读者图书证号:”);scanf(“%s”,return_reader_num);当(下一个)!= null && strcmp(return_reader_num,Qreader_num)!= 0)下一个;如果(Q = = null && >下strcmp(return_reader_num,Qreader_num)!= 0)发现= 2;/*用于设置标志,判断读者是否借了此书或是否不满足某一条而提前出错结束,若提前出错,则发现= 2,若借了此图书,则发现= 1,若没借此书则发现= 0,以下设置雷同*/printf(“n此读者编号不存在!按任意键返回. n”);去结束;printf(“n不请输入您归还图书的编号:”);scanf(“%s”,return_book_num);同时(P下一步)!= null && strcmp(return_book_num,Pbook_num)!= 0)下一页;如果(P >下= = null && strcmp(return_book_num,Pbook_num)!= 0)查找= 2;printf(“n不错误!此图书编号不存在!按任意键返回. n”);去结束;为(i = 0;i < <马克斯;我+ +)如果(strcmp(return_book_num,Q借我。borrow_book_num)= = 0)查找= 1;为(J =我;J <该;j+)strcpy(Q借J。borrow_book_num,Q借 J + 1 。borrow_book_num);strcpy(Q借J。huanshu_date,Q借 J + 1 。huanshu_date);strcpy(Q借该。borrow_book_num,“0”);strcpy(Q借该。huanshu_date,“0”);P > book_zaiguan_ + +;问:zuida -;printf(“n不编号%s的读者还书完毕!按任意键继续下步操作.”,return_reader_num);如果(查找= 0)printf(“n不错误!此读者未借此书!按任意键返回. n”);结束:getch();系统(“华彩”);无效show_allbook()BK病毒;P = h_book ->下;printf(“n不图书信息如下:n n”);printf(“不图书编号图书名称图书作者在馆册数总共册数n”);/*直接显示所有图书的信息,遍历图书链表一次就可以了*/而(P!= null)printf(“t %s %s %s T T T %d %dn”,Pbook_num,Pbook_name,Pbook_writer,P > book_zaiguan_,Pbook_zonggong_);下一页;printf(“n不图书显示完毕!按任意键继续下一步操作”。);printf(“n不- n”);getch();/系统(“CLS”);无效show_reader()RD;int i;P = h_reader;printf(“n读者信息如下:n n”);printf(“读者图书证号不读者姓名”);printf(“n”);而(P!= null)/遍历一次读者链表就可以了printf(“%s T/T %s”,Preader_num,Preader_name);为(i = 0;i < <马克斯;我+ +)printf(“n”);printf(“借书编号:”);printf(“不还书日期:”);printf(“n”);printf(“%s”,P借我。borrow_book_num);printf(“T T %s”,P借我。huanshu_date);printf(“n”);下一页;printf(“n读者信息显示完毕!按任意键继续下一步操作”。);getch();/系统(“CLS”);无效main()fp_book文件*,* fp_reader;/ /创建文件型指针printf(“n n n n n nn T T T欢迎使用图书管理系统n n”);printf(“n nn T T T请按任意键进入”。);getch();系统(“CLS”);如果(fp_book = fopen(“书.txt”、“rb”)= = null | |(fp_reader = fopen(“读者.txt”、“rb”)= = null)();其他();menu_select_book();/ /调用主菜单国际menu() /主菜单int i;printf(“n n n n n”);printf(“不| - | n”);printf(“不|图书馆管理系统| n”);printf(“不| - | n”);printf(“不| 0退出系统| n”);printf(“不| 1新进图书| n”);printf(“不| 2删除图书| n”);printf(“不| 3借阅图书| n”);printf(“不| 4归还图书| n”);printf(“不| 5修改图书信息| n”);printf(“不| 6查询图书信息| n”);printf(“不| 7显示所有图书信息| n”);printf(“不| 8显示所有读者信息| n”);printf(“不| - | n”);printf(“n不请输入相应的操作(1-8):”);为了(;)scanf(“%d”,与我);printf(“不- n”);fflush(stdin);如果(i0 | |我> 8)printf(“n不错误!请重新输入:”);别人休息;还我;无效menu_select_book() /主菜单选择为(;)/循环调用模式,保证能进行重复操作开关(menu())/功能选择案例0:系统(“CLS”);save();Printf ("nnnnnnnnnntttt, thank you for your use!");Getch ();Exit (0);Case 1:Insert_New_Book ();Break;Case 2:Delete_Book ();Break;Case 3:Borrow_Book ();Break;Case 4:Return_Book ();Break;Case 5:Modify_book ();Break;Case 6:Select_book ();Break;Case 7:Show_Allbook ();Break;Case 8:Show_reader ();Break;Default:Printf ("nt error! Please re input:!");Exit (0);

    注意事项

    本文(图书馆管理系统(Library management system).doc)为本站会员(scccc)主动上传,三一文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    经营许可证编号:宁ICP备18001539号-1

    三一文库
    收起
    展开