图书资料管理
图书资料管理主要完成图书资料的新增、修改和报废,并生成图书资料库的功能。按采购员的要求,供书商提供需要的书籍。进行分类新增修改处理。并对已报废图书进行处理。
读者资料管理
读者资料管理主要完成读者资料的新增、修改和撤消,并生成读者资料库。按读者要求进行读者资料的新增、修改和撤消。
借书操作
借书操作主要完成读者的借书、续借及预订处理,并生成读者借阅库。首先进行读者资格的审核,符合要求后查阅书库是否有书,如有则修改图书资料库,书库取书书交读者。书库无书则进行预订处理。用户续借则修改还书日期。并将借书信息汇总后交统计员。
还书操作
还书操作主要完成读者的还书及罚款处理,并修改读者借阅库。首先进行读者资格的审核,符合要求后则修改图书资料库,读者还书书还书库。书籍逾期或遗失则进行罚款处理。并将还书信息汇总后交统计员。
查询处理
查询处理主要完成读者对书是否逾期、书是否未借、书籍排行榜的查询处理。并及时地把查询结果反馈给读者,并将查询信息汇总给统计员。
系统维护
包括权限管理、数据恢复和数据备份。数据恢复和数据备份是对数据的有效保护。权限管理是对系统使用者规定相关的权限,以免系统数据被非法访问和使用。
(访问时需要密码,密码错误要有提示重输,登陆分为管理员登陆和用户登陆两项,用户只能进行查询操作,而管理员能进行所有操作)
#include #include class Book{ // 书籍基类 protected: char Title[40]; // 书名 long Code; // 条码 int Type; // 0表示书,1表示杂志 public: Book(); Book(char *title,long code); void SetCode(long code){ Code = code; } void SetTitle(char* tl){ strcpy(Title,tl); } void SetType(bool type){Type = type; } int GetType(){ return Type; } long GetCode(){ return Code;} virtual void Show(); // 显示书的信息 friend ostream& operator<<(ostream& , Book&); // 重载插入运算符 friend istream& operator>>(istream& is, Book&); // 重载提取运算符 Book *Next; // 为创建每个读者所借书链表而定义指针 }; class Item :public Book{ //书的款目 // char Title[40]; // 书名 char Author[20]; // 著者名 char IndexCode[10]; // 分类号 // long Code; // 条码 public: Item(); Item(char *author,char *title,char *index,int code); Item(Item &); void SetAuthor(char*); void SetIndexCode(char*); virtual void Show(); // 显示书的信息 friend ostream& operator<<(ostream& os, Item&); // 重载插入运算符 friend istream& operator>>(istream& is, Item&); // 重载提取运算符 public: }; class Magazine:public Book { //杂志类 int Volume; enum LANG {CHINESE=1,ENGLISH} Lang; // 枚举变量,确定语言类别 public: Magazine():Book(){Volume = 0; Lang = CHINESE; Type = 1; } Magazine(char *title,int vol,LANG lang,int code); Magazine(Magazine&); void SetVolume(int vol){Volume = vol;} void SetLang(int lang){Lang = (LANG)lang;} virtual void Show(); // 显示杂志的信息 friend ostream& operator<<(ostream& os, Magazine&); // 重载插入运算符 friend istream& operator>>(istream& is, Magazine&); // 重载提取运算符 }; class Reader{ // 读者信息类 char Name[20]; // 姓名 char Position[20]; // 职务 int Age; // 年龄 long Code; // 借书证号 Book* items; // 所借书链表 public: Reader(); Reader(char *name,char *posi,int age,int code); // Reader(Reader&); ~Reader(); long GetCode(){return Code;} void SetName(char*); void SetPosition(char*); void SetAge(int); void SetCode(long); void AddBook(Item); // 添加所借书 void AddBook(Magazine); // 添加所借杂志 void DelBook(Book it); // 还书后减少所借书 void ShowBooks(); // 显示所借书 void Show(); // 显示读者信息 friend ostream& operator<<(ostream& os, Reader&); // 重载插入运算符 friend istream& operator>>(istream& is, Reader&); // 重载提取运算符 public: int Counter; //计数器,统计所借书数目 }; class Manager{ // 管理员类 char Name[20]; // 姓名 int Age; // 年龄 int Code; // 工号 friend class Library; // 将图书馆类声明为友元 public: Manager(){} Manager(char*,int,int); long GetCode(){ return Code;} void Show(); friend ostream& operator<<(ostream& os, Manager&); // 重载插入运算符 friend istream& operator>>(istream& is, Manager&); // 重载提取运算符 }; class Loan { // 借阅信息类 int Type; // 0表示书,1表示杂志 Item item; // 借阅书 Magazine mag; // 借阅杂志 Reader reader; // 借阅者 Manager manager; // 借书操作员 int Code; friend class Library; // 将图书馆类声明为友元 public: Loan(){ } Loan(Loan & l); int GetCode(){ return Code;} void Show(); friend ostream& operator<<(ostream& os, Loan&); // 重载插入运算符 friend istream& operator>>(istream& is, Loan&); // 重载提取运算符 }; 、、、、、、、、、、、、、、、、、、、、、、、 #include #include class Reader; template template public: T Info;//数据域 DblNode public: DblNode(T data);//一般结点 DblNode();//头结点 T GetInfo(){return Info;}; friend class DblList friend class Library; }; template DblNode public: DblList(); ~DblList(); void Insert(const T& data); DblNode void Print(); int Length();//计算链表长度 DblNode DblNode void MakeEmpty(); //清空链表 void ShowList(); //显示链表各结点 friend istream& operator>>(istream&, DblList friend ostream& operator<<(ostream& os, DblList friend class Library; //其它操作 }; template llink=rlink=NULL; } template info=data; llink=NULL; rlink=NULL; } template head=new DblNode head->rlink=head->llink=head; current=NULL; } template MakeEmpty();//清空链表 delete head; } template DblNode while(head->rlink!=head){ tempP=head->rlink; head->rlink=tempP->rlink;//把头结点后的第一个节点从链中脱离 tempP->rlink->llink=head;//处理左指针 delete tempP; //删除(释放)脱离下来的结点 } current=NULL; //current指针恢复 } template current=new DblNode current->Info=data; current->rlink=head;//注意次序 current->llink=head->llink; head->llink->rlink=current; head->llink=current;//最后做 } template current=head->rlink; while(current!=head&¤t!=p) current=current->rlink; if(current==head) current=NULL; else{//结点摘下 p->llink->rlink=p->rlink; p->rlink->llink=p->llink; p->rlink=p->llink=NULL; } return current; } template current=head->rlink; while(current!=head&¤t->Info!=data) current=current->rlink; if(current==head) current=NULL; return current; } template current=head->rlink; int temp =current->Info.GetCode(); while(current!=head&&temp!=data){ current=current->rlink; temp = current->Info.GetCode(); } if(current==head) current=NULL; return current; } template current=head->rlink; while(current!=head){ cout< current=current->rlink; } cout< template int count=0; current=head->rlink; while(current!=head){ count++; current=current->rlink; } return count; } template int count=0; current=head->rlink; while(current!=head){ current->GetInfo().Show(); current=current->rlink; } return ; } template istream& operator>>(istream& is, DblList int len; T tt; // 定义局部变量读入一个结点 is>>len; for(int i= 0 ;i dlist.Insert(tt); } return is; } template ostream& operator<<(ostream& os, DblList DblNode int len = dlist.Length(); os< while(tempP!=dlist.head){ // 循环输出链表各结点 os< tempP = tempP->rlink; } return os; } #include "class.h" #include "dblist.h" #include class Library{ // 封装图书馆流通业务的类 DblList DblList DblList DblList DblList int itemNum; // 记录在馆图书数目 int magNum; // 记录在馆杂志数目 int readerNum; // 记录读者数目 int loanNum; // 记录借阅信息数目 int managerNum; // 记录管理员数目 ofstream itemFileOut; // 文件流对象,保存图书馆书籍数据 ifstream itemFileIn; // 文件流对象,读入图书馆书籍数据 ofstream magFileOut; // 文件流对象,保存图书馆杂志数据 ifstream magFileIn; // 文件流对象,读入图书馆杂志数据 ofstream readerFileOut; // 文件流对象,保存图书馆读者数据 ifstream readerFileIn; // 文件流对象,读入图书馆读者数据 ofstream loanFileOut; // 文件流对象,保存图书馆借阅信息数据 ifstream loanFileIn; // 文件流对象,读入图书馆借阅信息 ofstream managerFileOut; // 文件流对象,保存图书馆管理员数据 ifstream managerFileIn; // 文件流对象,读入图书馆管理员数据 public: Library(); // 构造函数 ~Library(); //析构函数 void Run(); // 图书馆类的运行函数 void CreateBibliotheca(); // 创建书目 void CreateReader(); // 创建读者库 void CreateManager(); // 创建管理员信息 int ShowMainMenu(); // 显示主菜单函数 void Borrow(); // 借书操作 void Return(); // 还书操作 void Require(); // 查询操作 void SaveInfo(); // 保存图书馆信息 void OpenInfo(); // 读入图书馆信息 };下载本文