欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    武汉理工图书库存管理1.docx

    • 资源ID:15890226       资源大小:163.27KB        全文页数:26页
    • 资源格式: DOCX        下载积分:3金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

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

    武汉理工图书库存管理1.docx

    1、武汉理工图书库存管理11 系统需求分析1.1问题分析 完成程序,实现图书库存的管理。至少实现数据记录的增加、修改、删除、查询及相应结果的显示,查询应能按不同数据项进行1.2数据需求图书本身的信息有图书的ISBN,图书的名称,图书的作者,图书的出版社,图书的价格。图书的库存管理信息应包含图书的上次入库时间,图书的上次出库时间,现库存图书的数目。故所需的数据项如下:图书的ISBN string ISBN;图书的名称: string name;图书的作者: string author;图书上次入库时间: string in_date;图书上次出库时间: string out_date;图书现在库存数

    2、量: int num.1.3功能需求功能程序中的实现1、查询库存图书的信查询某书在结构体中的位置并输出该节点的信息2、图书入库在结构体链表中添加相应的节点3、图书出库在结构体链表中删除相应的节点4、修改某图书的库存信息在结构体链表中修改相应的节点的信息2系统设计2.1内存数据结构设计内存中,图书的相关信息用结构体链表定义,每一个节点包含某本书的全部信息struct bookstring ISBN;string name;string author;string in_date;string out_date;int num;book *next;由于在系统退出时,相关的图书信息都用表格的形式存

    3、储在文本文档中,其中第一行存储的不是图书信息,二十对下列图书信息对应项的说明。因此,在内存中定义了一个表示文本文档中第一行的结构体,如下:struct headline string firstline; book *next;用来保存文本中第一行的内容。在内存中,数据的结构如下图所示:firstlineISBN nameauthornumin_dateOut_date2.2数据文件设计图书的相关信息在退出系统是都保存在文本文档中。文本文档命名为” bookinformation”文本文档用列表的形式表示保存的图书信息,如下列所示:(部分图书信息,) ISBN 书名 作者 数量 上次入库时间

    4、上次出库时间7-115-13416-2 C+ Primer Plus 张建春 5 2008-07-01 2008-07-057-121-01665-6 算法引论 黄林鹏 6 2005-09-10 2005-09-157-302-08599-4 C+ 程序设计 谭浩强 6 2004-06-01 2004-06-067-900643-22-2 数据结构 严蔚敏 10 2006-05-01 2006-05-067-5427-2975-6 Flash8培训教程 柏松 15 2006-05-01 2006-05-062.3代码设计#include#include#includeusing namespa

    5、ce std;struct bookstring ISBN;string name;string author;string in_date;string out_date;int num;book *next;struct headline string firstline; book *next;void Search(); /函数申明void Add();void Delete();void Modify();void Menu();headline *Creatlink() /以图书馆的现存数据创建结构体链表的代码 headline *head=new headline; string

    6、 line,temp; ifstream fin(bookinformation.txt); getline(fin,line); head-firstline=line; head-next=NULL; int i,j=0,k=0,n; int a5; book *q,*p; while(getline(fin,line) q=new book; j=0,k=0; for(i=k;iline.size();) if(linei=t) aj=i; j+; k=i+1; i+; for(n=0;nISBN=temp; temp=; for(n=a0+1;nname=temp; temp=; fo

    7、r(n=a1+1;nauthor=temp; temp=; q-num=0; /找出该行图书信息的图书的数目 for(n=a2+1;nnum=q-num*10+(int(linen)-48); for(n=a3+1;nin_date=temp; temp=; for(n=a4+1;nout_date=temp; temp=; if(head-next=NULL) head-next=q; p=q; else p-next=q; p=q; p-next=NULL; fin.close(); return head;void main() Menu(); cout谢谢使用!endl;void Me

    8、nu() /主菜单的代码 cout*endl; cout 图书库存管理系统endl; cout 查询图书请输入1endl; cout 图书入库请输入2endl; cout 图书出库请输入3endl; cout 修改图书记录请输入4endl; cout 退出系统请输入5endl; cout*endl; char choice; coutchoice; while(int(choice)53) coutchoice; coutnnnn; switch(choice) case 1:coutnn;Search();break; case 2:coutnn;Add();break; case 3:co

    9、utnn;Delete();break; case 4:coutnn;Modify();break; case 5:exit(0);break; void Search()/查找功能的代码 cout*endl; cout 图书查询系统:endl; cout* 按 ISBN 序列号查询请输入1 *endl; cout* 按 书名 查询请输入2 *endl; cout* 按 作者 查询请输入3 *endl; cout* 返回上级菜单请输入4 *endl; cout*endl; coutchoice; while(int(choice)52) coutchoice; switch(choice) c

    10、ase 1: coutISBN; headline *head=Creatlink(); book *p=head-next; int tag=0; /表征是否查找成功,默认为查找不成功 while(p) if(p-ISBN=ISBN) tag=1; /表示查找成功 cout查找的图书信息如下:endl; coutfirstlineendl; coutISBNtnametauthortnumtin_datetout_dateendl; coutnext; if(tag=0) cout未找到所要查找的图书信息!nn; break; case 2: coutname; headline *head

    11、=Creatlink(); book *p=head-next; int tag=0; /表征是否查找成功,默认为查找不成功 while(p) if(p-name=name) tag=1; /表示查找成功 cout查找的图书信息如下:endl; coutfirstlineendl; coutISBNtnametauthortnumtin_datetout_dateendl; coutnext; if(tag=0) cout未找到所要查找的图书信息!nn; break; case 3: coutauthor; headline *head=Creatlink(); book *p=head-ne

    12、xt; int tag=0; /表征是否查找成功,默认为查找不成功 while(p) if(p-author=author) tag=1; /表示查找成功 cout查找的图书信息如下:endl; coutfirstlineendl; coutISBNtnametauthortnumtin_datetout_dateendl; coutnext; if(tag=0) cout未找到所要查找的图书信息!nn; break; case 4: Menu(); cout是否显示所有图书的信息?(y/n)decision; if(decision=y|decision=Y) headline *head=

    13、Creatlink(); coutfirstlinenext; while(p) coutISBNtnametauthortnumtin_datetout_datenext; cout是否继续查询图书的信息?(y/n)decision; if(decision=y|decision=Y) Search(); else Menu();void Add() /图书入库功能的代码 cout* 图书入库 *endl; cout请输入入库图书的相关信息:endl; string ISBN,name,author,in_date,out_date=; int num; book *addbook=new

    14、book; coutISBN; cin.get(); cout书名:; getline(cin,name); coutauthor; coutnum; coutin_date; addbook-ISBN=ISBN; addbook-name=name; addbook-author=author; addbook-num=num; addbook-in_date=in_date; addbook-next=NULL; headline *head=Creatlink(); book *p=head-next; int tag=0; while(p-next!=NULL) if(p-ISBN=I

    15、SBN) tag=1; p-num=p-num+num; delete addbook; break; else p=p-next; if(tag=0) if(p-ISBN=ISBN) p-num=p-num+num; delete addbook; else p-next=addbook; char decision; cout是否将改动写入文件?(y/n)decision; if(decision=y|decision=Y) ofstream fout(bookinformation.txt); foutfirstlinenext; while(p) foutISBNtnametautho

    16、rtnumtin_datetout_datenext; cout是否继续图书入库?(y/n)decision; if(decision=y|decision=Y) Add(); else Menu();void Delete() /图书出库功能的代码 cout* 图书出库 *endl; cout请输入出库图书的ISBN:ISBN; headline *head=Creatlink(); book *p=head-next; int tag=0; if(p-ISBN=ISBN) tag=1; cout该图书的信息如下:endl; cout ISBNt 书名t 作者t数量t入库时间endl; co

    17、utISBNtnametauthortnumtin_datenext=p-next; delete p; else book *q=p-next; while(q) if(q-ISBN=ISBN) tag=1; cout该图书的信息如下:endl; cout ISBNt 书名t 作者t数量t入库时间endl; coutISBNtnametauthortnumtin_datenext=q-next; delete q; break; else p=q; q=q-next; if(tag=0) cout输入有错,请从新输入endl; Delete(); char decision; cout是否将

    18、改动写入文件?(y/n)decision; if(decision=y|decision=Y) ofstream fout(bookinformation.txt); foutfirstlinenext; while(p) foutISBNtnametauthortnumtin_datetout_datenext; cout是否继续图书出库?(y/n)decision; if(decision=y|decision=Y) Delete(); else Menu();void Modify() /修改图书库存信息功能的代码 cout* 图书信息的修改 *endl; cout请输入要修改图书的相关

    19、信息:endl; string ISBN,in_date,out_date; int num; coutISBN; coutnum; coutin_date; coutout_date; headline *head=Creatlink(); book *p=head-next; int tag=0; while(p) if(p-ISBN=ISBN) tag=1; p-num=num; p-in_date=in_date; p-out_date=out_date; break; else p=p-next; if(tag=0) cout要修改的图书项不存在,请从新输入endl; Modify(); char decision; cout是否将改动写入文件?(y/n)decision; if(decision=y|decision=Y) ofstream fout(bookinformation.txt); foutfirstlinenext; while(p)


    注意事项

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

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




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开