欢迎来到得力文库 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
得力文库 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    2022年C语言图书馆信息管理 .pdf

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

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

    2022年C语言图书馆信息管理 .pdf

    #include #include #include using namespace std; class Librarian /图书管理员类 public: Librarian(); Librarian(int n,int j,char na20,int w ); int getnumber(); int getjobage(); char *getname(); int getwages(); void resetjobage(int j); void resetwages(int w); void resetname(char na20); private: int number; int jobage; char name20; int wages; ; Librarian:Librarian() /其函数的实现 number=0; char b20=no one; jobage=0; strcpy(name,b); Librarian:Librarian(int n,int j,char na20,int w) number=n; jobage=j; strcpy(name,na); wages=w; int Librarian:getjobage() return jobage; char *Librarian:getname() return name; int Librarian:getnumber() return number; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 16 页 - - - - - - - - - int Librarian:getwages() return wages; void Librarian:resetjobage(int j) jobage=j; void Librarian:resetname(char na20) strcpy(name,na); void Librarian:resetwages(int w) wages=w; class reader /读者类 private: int number; int age; char name20; char borrowbook20; public: reader(); reader(int c,int a,char b20,char e20); int getnumber(); int getage(); char *getname(); char * getborrowbook(); void reworkborrowbook(char a20); ; reader:reader() /其函数的实现 char a20=没有人 ; char c20=没有借书 ; number=0; age=0; reader:reader(int a,int c,char d20,char e20) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 16 页 - - - - - - - - - number=a; age=c; strcpy(name,d); strcpy(borrowbook,e); int reader:getnumber()return number; int reader:getage()return age; char *reader:getname()return name; char * reader:getborrowbook()return borrowbook; void reader:reworkborrowbook(char a20)strcpy(borrowbook,a); struct book /图书的结构体 int num; char name20; char writer20; ; void outbookinf() /输出所有图书信息 int i; ifstream infile(allbook.txt,ios:in); char line50; cout 书名 t书号 t作者 endl; for(i=1;i=10;i+) infile.getline(line,50,n); coutlinen; file.close(); else cout没有图书管信息理员; exit(0); ifstream is(controlloer.txt,ios_base:binary); if(is) Librarian *A=new Librariann; for(i=0;in;i+) is.read(char *)&Ai,sizeof(Ai); for(i=0;in;i+) cout 编号 t工龄 t名字 t工资 endl; coutAi.getnumber()tAi.getjobage()tAi.getname()tAi.getwages()endl; else couttxt文件打开出错 endl; is.close(); void libary() /图书馆的总信息 system(cls); system(color 2e); cout endl; cout endl; cout endl; cout 本校图书馆由本部图书馆及彭州校区图书馆组成,图书馆总面积达了* 平方米 ; cout (本馆现在有* 类书籍 * 万册, * 类书籍 * 万册, * 类书籍 * 万册 *类书籍 * 万册),; cout 图书馆现有工作人员* 名; cout 图书馆现有的现代化设备价值超过* 万元n; file.close(); else n=0; cout 已有的图书管理员个数:; coutnendl; coutnumagenamewage; Librarian A(num,age,name,wage); cout 编号工龄名字工资 endl; coutA.getnumber() A.getjobage() A.getname() A.getwages()endl; ofstream outfile(controlloer.txt,ios_base:app ); outfile.write(char *)&A,sizeof(A); outfile.close(); n+; ofstream tfile(serchLaninf.txt); tfilen; tfile.close(); coutn; file.close(); else cout没有图书管信息理员; exit(0); cout 已有的图书管理员个数:; coutnendl; Librarian *A=new Librariann; ifstream is(controlloer.txt,ios_base:binary); if(is) for(i=0;in;i+) is.read(char *)&Ai,sizeof(Ai); for(i=0;in;i+) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 16 页 - - - - - - - - - cout 编号工龄名字工资endl; coutAi.getnumber() Ai.getjobage() Ai.getname() Ai.getwages()endl; else cout 打开文件出错endl; is.close(); couth; coutjobagenamewage; Ah-1.resetjobage(jobage); Ah-1.resetname(name); Ah-1.resetwages(wage); cout该管理员修改后的名字是:Ah-1.getname() 工龄是:Ah-1.getjobage() 工资是 :Ah-1.getwages()endl; ofstream tfile(controlloer.txt,ios_base:binary); for(j=0;jn;j+) tfile.write(char *)&Aj,sizeof(Aj); tfile.close(); void aadbook() /新增图书 int num;char name12;char writer10;int n; a: ofstream fout(allbook.txt,ios:app); cout 请录入图书信息:endl; cout 书名 t书号 t作者 name;foutnamenum;foutnumwriter;foutwritern; fout.close(); cout 是否继续录入?1. 是 2. 否n; if(n=1) goto a; else void studentland(); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 16 页 - - - - - - - - - studentland(); void delate() /删除函数 int m; cout 选择操作选项:endl; cout 1.删除全部信息endl; cout 2.单个删除 m; if(m=1) ofstream file(allbook.txt,ios:trunc); cout 全部删除完毕,按任意键返回!endl; file.close(); getch(); system(cls); void studentland(); studentland(); char str1080,buf20; a: int i=0,flag=100,c=0; ifstream fin(allbook.txt); if(!fin) cout 文件打开失败!endl; getch(); system(cls); void studentland(); studentland(); cout 请输入你要删除的书名:buf; strcat(buf,t); while(fin.getline(stri,80) if(strncmp(stri,buf,strlen(buf)=0) flag=i; i+; fin.close(); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 16 页 - - - - - - - - - if(flag=100) cout 没有你所要删除的书籍!重新按1,否则 0.b; if(b=1)goto a; else c=1; if(c=0) ofstream fout(allbook.txt); for(int j=0;ji;j+) if(j=flag)continue; foutstrjendl; fout.close(); cout 你要删除的书籍的信息已删除, 继续按 1,否则按0.b; if(b=1)goto a; cout 操作已经结束,按任意键返回.endl; getch(); system(cls); void studentland(); studentland(); void searchbook() / 查找书籍 a: ifstream fin; int flag=0,b,length; char str20; char f200;char g200; fin.open(allbook.txt); if(!fin) coutOpen f1.dat error.endl; exit(1); while(1) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 16 页 - - - - - - - - - coutstr; strcat(str,t); length=strlen(str); cout-endl; while(fin.getline(f,199) strcpy(g,f); if(strncmp(str,f,length)=0) flag=1; break; if(flag=1) cout 所查询的书已经找到:n; cout-endl; cout 书名 t书号 t作者 tendl; coutgendl; cout-endl; flag=0; cout 要继续查询按1,否则按0: b; if(b=0)break; else fin.close(); cout 没有此书 ,继续按 1,否则按0.b; if(b=0)break; goto a; fin.close(); cout 查询完毕,按任意键返回.endl; getch(); system(cls); void studentland(); studentland(); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 9 页,共 16 页 - - - - - - - - - void seachreader() / 查询读者信息 a: ifstream fin; int flag=0,b,length; char str20; char f200;char g200; fin.open(readernum.txt); if(!fin) cout 没有此信息文件!endl; exit(1); while(1) coutstr; strcat(str,t); length=strlen(str); cout-endl; while(fin.getline(f,199) strcpy(g,f); if(strncmp(str,f,length)=0) flag=1; break; if(flag=1) cout 所查询的读者已经找到:n; cout-endl; cout 名字 t编号 t年龄 t借书次数 endl; coutgendl; cout-endl; flag=0; cout 要继续查询按1,否则按0: b; if(b=0)break; goto a; else 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 10 页,共 16 页 - - - - - - - - - fin.close(); cout 没有此人 ,继续按 1,否则按0.b; if(b=0)break; goto a; fin.close(); cout 查询完毕,按任意键返回.b; file.close(); else cout没有文件 ; cout 已有的读者个数:; coutbendl; reader *A=new readerb; ifstream is(reader.txt,ios_base:binary); if(is) for(i=0;ib;i+) is.read(char *)&Ai,sizeof(Ai); else couttxt文件打开出错 endl; is.close(); couta; for(i=0;ib;i+) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 11 页,共 16 页 - - - - - - - - - if(strcmp(Ai.getname(),a)=0) cout 编号年龄名字借书情况 endl; coutAi.getnumber() Ai.getage() Ai.getname() Ai.getborrowbook()endl; h+; if(h=0)cout没有这个读者!; */ void Librarianland() /管理员登陆函数 int q,l=1,i,h; system(cls); system(color 2e); cout endl; cout endl; cout endl; cout i; while(l) if(i=00000) system(cls); system(color 3e); cout endl; cout endl; cout endl; cout |* 0,返回上一级菜单. *|endl; cout |* 1,查询图书馆管理员的信息 *|endl; cout |* 2,存入新的管理员信息. *|endl; cout |* 3,修改图书管理员的信息 *|endl; cout |* 4,新增图书 *|endl; cout |* 5,删除图书 *|endl; coutq; if(q=0&q6) 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 12 页,共 16 页 - - - - - - - - - switch(q) case 0: l=0; break; case 1:serchLaninf(); system(pause); break; case 2:storelibrarian(); system(pause); case 3:reLaninf(); system(pause); break; case 4: void aadbook(); aadbook(); break; case 5: void delate(); delate(); break; default: break; else system(cls); system(color 4e); cout endl; cout endl; cout endl; cout 操作无效! endl; cout endl; cout endl; cout endl; system(pause); else system(cls); system(color 2e); cout endl; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 13 页,共 16 页 - - - - - - - - - cout endl; cout endl; cout 身份确认失败 endl; cout 是否重新确认!endl; cout 重新确认请按请按1, 放弃请按0endl; couth; if(h=0) l=0; if(h=1) system(cls); system(color 2e); cout endl; cout endl; cout endl; cout i; void studentland() /学生登陆函数 int h; char l=y; while(l=y) system(cls); system(color 3e); cout endl; cout endl; cout endl; cout endl; cout endl; cout endl; cout * |输出藏书信息 , 请按 1 | *endl; cout * |查询图书馆的总信息,请按2| *endl; cout * |按书名查找图书, 请按 3 | *endl; cout * |查询读者的信息, 请按 4 | *endl; cout * |返回上一级菜单, 请按 0 | *endl; couth; if(h=0&h5) switch(h) case 0: l=n; break; case 1:outbookinf(); system(pause); break; case 2:libary(); system(pause); break; case 3:searchbook(); system(pause); break; case 4:seachreader(); system(pause); break; else system(cls); system(color 4e); cout endl; cout endl; cout endl; cout 您的操作是无效的! ! ! !endl; system(pause); void main() / 主函数 int h,l=1; while(l) system(cls); system(color 7c); cout endl; cout endl; cout endl; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 15 页,共 16 页 - - - - - - - - - cout 图书管理系统endl; cout endl; cout endl; cout -endl; cout |管理员登陆请按 1|endl; cout |学生登陆请按 2 |endl; cout |退出系统请按 0 |endl; cout -endl; coutendl; couth; if(h=0&h3) switch(h) case 0: cout 谢谢光临本图书馆!endl; exit(0); case 1: Librarianland(); system(pause); break; case 2: studentland(); system(pause); break; else system(cls); system(color 4e); cout endl; cout endl; cout endl; cout 您的操作是无效的! ! ! !endl; system(pause); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 16 页,共 16 页 - - - - - - - - -

    注意事项

    本文(2022年C语言图书馆信息管理 .pdf)为本站会员(Che****ry)主动上传,得力文库 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知得力文库 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

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




    关于得利文库 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

    © 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

    黑龙江省互联网违法和不良信息举报
    举报电话:0468-3380021 邮箱:hgswwxb@163.com  

    收起
    展开