C++版图书管理系统
本文实例为大家分享了C++版图书管理系统的具体代码,供大家参考,具体内容如下
使用介绍
图书管理系统源码由两部分组成,第一部分book.h头文件,第二部分book.cpp源文件。复制代码时需注意将book.h文件的源码单独放在一个一个文件里,文件名必须为book.h。源码文件也需放在一个单独的.cpp文件里。
book.h头文件
#include#include#include#include using namespace std; //会员类class VIP{public:int vnum; //会员号string name; //会员姓名int num; //图书编号string bookName; //书名string author; //作者string press; //出版社VIP *next; //指针}; //图书结点类class Node{public:int num; //图书编号string bookName; //书名string author; //作者string press; //出版社Node *next; //指针}; VIP vip[100]; Node book[100]; void add(); //增加图书函数void Output(Node p); //输出图书信息函数int LookupBook(); //通过书名查找void LookupAuthor(); //通过作者名查找int LookupNum(); //通过编号查找void LookupPress(); //通过出版社查找void addVIP(); //增加会员函数void OutputVIP(VIP s); //输出会员信息函数int LookupNumVIP(); //按编号查询会员void LookupNameVIP(); //按会员姓名查找会员void DeleteVIPbook(); //删除会员借书信息void Delete(); //删除会员函数void Query(); //根据会员编号查询借书信息void Return(); //还书函数void Borrow(); //图书借阅函数void Index(); //首页void BookInterface(); //图书管理界面void VIPInterface(); //会员管理界面void DeleteBook(); //删除图书函数void LookupBookIn(); //图书查询页面void LookupVIPIn(); //会员查询页面
book.cpp源文件
#include"book.h"int main(){Index(); //首页函数return 0; }//增加图书函数void add(){for(int i=0; i<100; i++){if(book[i].num==0){cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"<<"请输入图书编号:"; cin>>book[i].num; cout<>book[i].bookName; cout< >book[i].author; cout< >book[i].press; cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"<<"图书添加成功"<<"\n"< >bookname; for(int i=0; i<100; i++){if(book[i].bookName==bookname){j=1; Output(i); return i; }}if(j==0){cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"<<"没有该图书"<<"\n"< >author; for(int i=0; i<100; i++){if(book[i].author==author){j=1; Output(i); }}if(j==0){cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"<<"没有该图书"<<"\n"< >num; for(int i=0; i<100; i++){if(book[i].num==num){j=1; Output(i); return i; }}if(j==0){cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"<<"没有该图书"<<"\n"< >press; for(int i=0; i<100; i++){if(book[i].press==press){j=1; Output(i); break; }}if(j==0){cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"<<"没有该图书"<<"\n"< >vip[i].vnum; cout<<"\t"<<"\t"<<"\t"<<"\t"<<"请输入会员名:"; cin>>vip[i].name; cout<<"\t"<<"\t"<<"\t"<<"\t"<<"会员添加成功"<<"\n"< >num; for(int i=0; i<100; i++){if(vip[i].vnum==num){OutputVIP(i); j=1; return i; }}if(j==0){cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"<<"没有该会员"<<"\n"< >name; for(int i=0; i<100; i++){if(vip[i].name==name){j=1; OutputVIP(i); break; }}if(j==0){cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"<<"没有该会员"<<"\n"< >i; switch(i){case 1:BookInterface(); break; case 2:VIPInterface(); break; default:cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"<<"请输入1或2"<<"\n"< >i; switch(i){case 1:add(); //增加图书函数cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"; system("pause"); BookInterface(); break; case 2:LookupBookIn(); //图书查询页面break; case 3:Borrow(); //图书借阅函数cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"; system("pause"); BookInterface(); break; case 4:Return(); //还书函数cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"; system("pause"); BookInterface(); break; case 5:DeleteBook(); //删除图书函数cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"; system("pause"); BookInterface(); break; case 6:Index(); default:cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"<<"请输入对应编号"<<"\n"< >i; switch(i){case 1:addVIP(); //增加会员函数cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"; system("pause"); VIPInterface(); break; case 2:LookupVIPIn(); //会员查询页面break; case 3:Query(); //根据会员编号查询借书信息cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"; system("pause"); VIPInterface(); break; case 4:Delete(); //删除会员函数cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"; system("pause"); VIPInterface(); break; case 5:Index(); break; default:cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"<<"请输入对应编号"<<"\n"< >i; switch(i){case 1:LookupNum(); //通过编号查找cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"; system("pause"); LookupBookIn(); break; case 2:LookupBook(); //通过书名查找cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"; system("pause"); LookupBookIn(); break; case 3:LookupAuthor(); //通过作者名查找cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"; system("pause"); LookupBookIn(); break; case 4:LookupPress(); //通过出版社查找cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"; system("pause"); LookupBookIn(); break; case 5:BookInterface(); //图书管理界面break; case 6:Index(); break; default:cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"<<"请输入对应编号"<<"\n"< >i; switch(i){case 1:LookupNumVIP(); //按编号查询会员cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"; system("pause"); LookupVIPIn(); break; case 2:LookupNameVIP(); //按会员姓名查找会员cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"; system("pause"); LookupVIPIn(); break; case 3:VIPInterface(); //会员管理界面break; case 4:Index(); break; default:cout<<"\n"<<"\t"<<"\t"<<"\t"<<"\t"<<"请输入对应编号"<<"\n"<
【C++版图书管理系统】以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
推荐阅读
- C++项目开发实现图书管理系统
- Axure RP 9 Mac/win(交互原型设计软件)中文版
- MATLAB R2020b Mac/win(商业数学软件)中文版
- Python爬取分享|使用Python获取国际版淘宝AliExpress的商品信息
- C++基础知识|C++(char型总结一些细节知识点)
- 2022年官网下安装GIT最全版与官网查阅方法
- C++|c++中string的模拟实现
- C/C++|C++中简单的string类的实现
- c++|c++的string类的模拟实现 以及basic_string::_M_construct null not valid错误的原因
- C++|[C/C++]详解STL容器1--string的功能和模拟实现(深浅拷贝问题)