2022-03-1114:36:52作者:维维sanguine
在本程序中共有四个类:
book类:此类有书的基本信息:书名,编号,作者,价格等,和基本的get()和set()方法。类图如下:
reader_admin类:此类中有一个存放读者对象的数组,并且可以进行添加读者,修改读者信息等操作。类图如下:
登陆页面如下
读者页面
管理员页面
在本程序过程中的不足:
“book.h"
#pragmaonce#include
#include"book.h"book::book(){name="";n_number=0;s_number=0;id=0;author="";price=0;}book::book(stringname,intn_number,ints_number,intid,stringauthor,doubleprice){this->name=name;this->n_number=n_number;this->s_number=s_number;this->id=id;this->author=author;this->price=price;}//get方法。stringbook::get_name(){returnname;}intbook::get_n_number(){returnn_number;}intbook::get_s_number(){returns_number;}intbook::get_id(){returnid;}stringbook::get_author(){returnauthor;}doublebook::get_price(){returnprice;}//set方法。voidbook::set_name(stringname){this->name=name;}voidbook::set_n_number(intn_number){this->n_number=n_number;}voidbook::set_s_number(ints_number){this->s_number=s_number;}voidbook::set_id(intid){this->id=id;}voidbook::set_author(stringauthor){this->author=author;}voidbook::set_price(doubleprice){this->price=price;}"library.h"
#pragmaonce//存储学生信息#include"book.h"classreader_infor{public:reader_infor();reader_infor(stringId,stringName,stringGrade,intNumber);//get函数stringget_r_id();//返回学生的学号。stringget_r_name();//返回学生的名字。stringget_r_grade();//返回学生的班级。intget_r_borrow();//返回学生借阅书籍的数量。//set函数voidset_r_id(stringID);voidset_r_name(stringName);voidset_r_grade(stringGrade);voidset_r_borrow(intNumber);private:stringr_id;//学生的学号stringr_name;//学生的名字stringr_grade;//学生的班级intr_borrow;//学生借阅书籍的数量};"reader_infor.cpp"
#include"reader_infor.h"//构造函数reader_infor::reader_infor(){r_id="";r_name="";r_grade="";r_borrow=0;}reader_infor::reader_infor(stringid,stringname,stringgrade,intnumber){this->r_id=id;this->r_name=name;this->r_grade=grade;this->r_borrow=number;}//get函数stringreader_infor::get_r_id(){returnthis->r_id;}stringreader_infor::get_r_name(){returnthis->r_name;}stringreader_infor::get_r_grade(){returnthis->r_grade;}intreader_infor::get_r_borrow(){returnthis->r_borrow;}//set函数voidreader_infor::set_r_id(stringId){this->r_id=Id;}voidreader_infor::set_r_name(stringName){this->r_name=Name;}voidreader_infor::set_r_grade(stringGrade){this->r_grade=Grade;}voidreader_infor::set_r_borrow(intBorrow){this->r_borrow=Borrow;}