当前位置:网站首页>Library management backstage
Library management backstage
2022-06-24 04:26:00 【Take you to learn code】
#include<iostream>
#include<string>
#include<vector>
#include<fstream>
#include<map>
using namespace std;
class basic
{
private:
static int book_num;
static int book_time;
public:
basic()
{
};
~basic();
static int getbook_num()
{
return book_num;
}
static int getbook_time()
{
return book_time;
}
};
/*int basic::getbook_num()
{
return book_num;
}
int basic::getbook_time()
{
return book_time;
}*/
// Date class ***************************
class date
{
private:
int year;
int month;
int day;
public:
friend ostream & operator<<(ostream &out,date &p);
friend istream & operator>>(istream &in,date &p );
date operator+(int n);
bool operator<(const date &d) const;
date(int year,int month=1,int day=1);
date();
int getyear();
int getmonth();
int getday();
};
int date::getyear()
{
return year;
}
int date::getmonth()
{
return month;
}
int date::getday()
{
return day;
}
date::date()
{
year = 2022;
day = 1;
month = 1;
}
date::date(int year,int month,int day)
{
this->year=year;
this->month=month;
this->day=day;
}
date date::operator+(int n)
{
bool temp = 0;
if(n%4==0&&n%100!=0||n%400==0)
temp=1;
int day_sum,temp_month;
int month_num[12]={31,28,31,30,31,30,31,31,30,31,30,31};
if(temp==1)
{
month_num[1]=29;
}
day_sum=day+n;
// cout<<"daysum"<<day_sum<<endl;
//cout<<"month_num"<<month_num[month-1]<<endl;
if(day_sum>month_num[month-1])
{
for(int i = month;day_sum>month_num[i-1];month++)
{
day_sum=day_sum-month_num[i-1];
i=month-1;
if(month>12)
{
year++;
month=month-12;
}
}
}
day = day_sum;
return *this;
}
bool date::operator<(const date &d) const
{
if(year!=d.year) return year<=d.year;
else if(month!=d.month) return month<=d.month;
else return day<=d.day;
/*if(year!=d.getyear()) return year<=d.getyear();
else if(month!=d.month) return month<=d.getmonth();
else return day<=d.getday();*/
}
// Overload input and output
ostream & operator<<(ostream &out,date &p)
{
out<<p.year<<"/"<<p.month<<"/"<<p.day;
return out;
}
istream & operator>>(istream &in,date &p)
{
int y, m, d, max_day;
bool temp = 0;
char op;
in >> y >> op >> m >> op >> d;
if (y % 4 == 0 && y % 100 != 0) temp=1;
if (y % 400 == 0) temp=1;
temp = 1;
if (m >= 13 || m <= 0) {
return in;
} else if (m == 2) {
max_day = (temp ? 29 : 28);
} else if (m < 8) {
max_day = (m & 1) ? 31 : 30;
} else {
max_day = (m & 1) ? 30 : 31;
}
if(d<=max_day)
{
p.year=y;
p.month=m;
p.day=d;
}
return in;
}
// Borrowing records
/*
Borrowing records : Include date 、 Book number 、 Reader student number 、 type ( Lend / Return / Renew (a library book) )、 Book types ( Basics / Literary leisure / major );
*/
class records
{
private:
date date_r;
string book_num;
string uu_id;
string uu_type;
string book_type;
public:
records(date date_r,string book_num,string uu_id,string uu_type,string book_type);
records(){
}
void setdate(date date_r);
void setbook_num(string book_num);
void setuu_id(string uu_id);
void setuu_type(string uu_type);
void setbook_type(string book_type);
date getdate(){return date_r;}
string getbook_num();
string getuu_id();
string getuu_type();
string getbook_type();
friend ostream & operator<<(ostream &out,records &d1);
friend istream & operator>>(istream &in,records &d1);
};
void records::setdate(date date_r)
{
this->date_r=date_r;
}
void records::setbook_num(string book_num)
{
this->book_num=book_num;
}
void records::setuu_id(string uu_id)
{
this->uu_id=uu_id;
}
void records::setuu_type(string uu_type)
{
this->uu_type=uu_type;
}
void records::setbook_type(string book_type)
{
this->book_type=book_type;
}
string records::getbook_num()
{
return book_num;
}
string records::getuu_id()
{
return uu_id;
}
string records::getuu_type()
{
return uu_type;
}
string records::getbook_type()
{
return book_type;
}
records::records(date date_r,string book_num,string uu_id,string uu_type,string book_type)
{
this->date_r=date_r;
this->book_num=book_num;
this->book_type=book_type;
this->uu_id=uu_id;
this->uu_type=uu_type;
}
ostream & operator<<(ostream &out,records &d1)
{
// date date_r,string book_num,string uu_id,string uu_type,string book_type;
out<<d1.date_r<<" "<<d1.book_num<<" "<<d1.uu_id<<" "<<d1.uu_type<<" "<<d1.book_type<<endl;
return out;
}
istream & operator>>(istream &in,records &d1)
{
in>>d1.date_r>>d1.book_num>>d1.uu_id>>d1.uu_type>>d1.book_type;
return in;
}
/* Reader class : Student number 、 full name 、 major 、 class 、 Number of books borrowed 、 Borrowing record vector ;*/
/* Books : Book number 、 Title 、 author 、 Press. 、 Publication date 、 Book types ( Basics / Literary leisure / major )、 Total collection 、 Number of in the Museum 、 Borrowing records
vector ;*/
class books
{
private:
friend istream & operator >>(istream &in,books &b2);
friend ostream & operator <<(ostream &out,books &b2);
string book_num;
string book_name;
string book_writer;
string book_press;
date book_pdate;
string book_type;
int book_sum;
int book_nownum;
public:
books(){}
books(string book_num,string book_name,string book_writer,string book_press,date book_pdate,string book_type,int
book_sum,int book_nownum);
string getbook_num();
string getbook_name();
string getbook_writer();
string getbook_press();
date getbook_pdate();
string getbook_type();
int getbook_sum();
int getbook_nowsum();
void setbook_num(string book_num);
void setbook_name(string book_name);
void setbook_writer(string book_writer);
void setbook_press(string book_press);
void setbook_pdate(date book_pdate);
void setbook_type(string book_type);
void setbook_sum(int book_sum);
void setbook_nowsum(int book_nownum);
};
string books::getbook_num()
{
return book_num;
}
string books::getbook_name()
{
return book_name;
}
string books::getbook_writer()
{
return book_writer;
}
string books::getbook_press()
{
return book_press;
}
date books::getbook_pdate()
{
return book_pdate;
}
string books::getbook_type()
{
return book_type;
}
int books::getbook_sum()
{
return book_sum;
}
int books::getbook_nowsum()
{
return book_nownum;
}
void books::setbook_num(string book_num)
{
this->book_num=book_num;
}
void books::setbook_name(string book_name)
{
this->book_name=book_name;
}
void books::setbook_writer(string book_writer)
{
this->book_writer=book_writer;
}
void books::setbook_press(string book_press)
{
this->book_press=book_press;
}
void books::setbook_pdate(date book_pdate)
{
this->book_pdate=book_pdate;
}
void books::setbook_type(string book_type)
{
this->book_type=book_type;
}
void books::setbook_sum(int book_sum)
{
this->book_sum=book_sum;
}
void books::setbook_nowsum(int book_nownum)
{
this->book_nownum=book_nownum;
}
books::books(string book_num,string book_name,string book_writer,string book_press,date book_pdate,string book_type,int
book_sum,int book_nownum)
{
this->book_num=book_num;
this->book_name=book_name;
this->book_writer=book_writer;
this->book_press=book_press;
this->book_pdate=book_pdate;
this->book_type=book_type;
this->book_sum=book_sum;
this->book_nownum=book_nownum;
}
istream & operator>>(istream &in,books &b2)
{
/*
string book_num;
string book_name;
string book_writer;
string book_press;
string book_pdate;
string book_type;
int book_sum;
int book_nownum;
*/
in>>b2.book_num>>b2.book_name>>b2.book_writer>>b2.book_press>>b2.book_pdate>>b2.book_type>>b2.book_sum>>b2.
book_nownum;
return in;
}
ostream & operator<<(ostream &out,books &b2)
{
out<<b2.book_num<<" "<<b2.book_name<<" "<<b2.book_writer<<" "<<b2.book_press<<" "<<b2.book_pdate<<"
"<<b2.book_type<<" "<<b2.book_sum<<" "<<b2.book_nownum<<endl;
return out;
}
/* Operation class :
Data member : The book / Student / Borrowing record vector
Member functions : Read and write books 、 Complete the addition, deletion, search and modification of the basic information of the book in the book vector ;
Read and write documents to students 、 Add, delete, check and modify the basic information of students in the student vector ;
The management and statistics functions of borrowing records will be added later ;*/
class Work
{
private:
vector<books>book_v;// Book vector
//vector<reader>reader_v;// Student vector
multimap<string,int>book_num;
multimap<string,int>book_name;
multimap<string,int>book_press;
multimap<string,int>book_writer;
multimap<date,int>book_date;
public:
Work();
~Work()
{
book_w();
//stu_w();
}
Work(books b1);
void book_r();
void book_w();
void book_a(books &b);
void book_del(string n);
void renewBookMap();
int bookfind_num(string n,int flag);// Query by book number
void bookfind_name(string n);
void bookfind_press(string n);
void bookfind_date(date d);
void bookfind_date_range(date d1,date d2);
void book_correct(string n,books &b);
void bookfind_vague(string n);
void find_bookandwriter(string b_name, string w_name);
void find_pressandwriter(string b_press, string w_name);
void search_booktype(string type);
void search_bookwriter(string writer);
};
Work::Work(books b1)
{
book_v.push_back(b1);
//reader_v.push_back(r1);
book_r();
//stu_r();
//cout<<book_v.size()<<endl;
//cout<<reader_v.size()<<endl;
book_name.insert(make_pair(b1.getbook_name(),book_v.size()-1));
book_num.insert(make_pair(b1.getbook_num(),book_v.size()-1));
book_press.insert(make_pair(b1.getbook_press(),book_v.size()-1));
book_writer.insert(make_pair(b1.getbook_writer(),book_v.size()-1));
book_date.insert(make_pair(b1.getbook_pdate(),book_date.size()-1));
}
Work::Work()
{
book_r();
//stu_r();
}
void Work::book_r()
{
books book;
ifstream ifs("2021213057book.txt");
if(!ifs)
return;
while(ifs>>book)
{
//cout<<"OK"<<endl;
book_v.push_back(book);
book_name.insert(make_pair(book.getbook_name(),book_v.size()-1));
book_num.insert(make_pair(book.getbook_num(),book_v.size()-1));
book_press.insert(make_pair(book.getbook_press(),book_v.size()-1));
book_writer.insert(make_pair(book.getbook_writer(),book_v.size()-1));
book_date.insert(make_pair(book.getbook_pdate(),book_v.size()-1));
}
ifs.close();
}
void Work::book_w()
{
fstream ofs("2021213057book.txt",ios::out);
vector<books>::iterator it;
for(it=book_v.begin();it!=book_v.end();it++)
{
ofs<<*it;
}
ofs.close();
}
void Work::book_a(books &b)
{
multimap<string,int>::iterator it;
it=book_num.find(b.getbook_num());
if(it==book_num.end())
{
b.setbook_sum(b.getbook_sum()+1);
b.setbook_nowsum(b.getbook_nowsum()+1);
book_v.push_back(b);
book_name.insert(make_pair(b.getbook_name(),book_v.size()-1));
book_num.insert(make_pair(b.getbook_num(),book_v.size()-1));
book_press.insert(make_pair(b.getbook_press(),book_v.size()-1));
book_writer.insert(make_pair(b.getbook_writer(),book_v.size()-1));
book_date.insert(make_pair(b.getbook_pdate(),book_date.size()-1));
}
else
{
b.setbook_sum(book_v[it->second].getbook_sum()+1);
b.setbook_nowsum(book_v[it->second].getbook_nowsum()+1);
book_v[it->second]=b;
} }
void Work::book_del(string n)
{
int index=bookfind_num(n,0);
if(index!=-1)
{
book_v.erase(book_v.begin()+index);
renewBookMap();
}
//cout<<it->getbook_num()<<endl;
//book_v.erase(it);
}
void Work::renewBookMap()
{
vector<books>::iterator it;
book_name.clear();
book_num.clear();
book_press.clear();
book_writer.clear();
book_date.clear();
int index=0;
for(it = book_v.begin();it<book_v.end();it++)
{
index=it-book_v.begin();
book_name.insert(make_pair(it->getbook_name(),index));
book_num.insert(make_pair(it->getbook_num(),index));
book_press.insert(make_pair(it->getbook_press(),index));
book_writer.insert(make_pair(it->getbook_writer(),index));
book_date.insert(make_pair(it->getbook_pdate(),index));
} }
int Work::bookfind_num(string n,int flag)
{
multimap<string,int>::iterator it;
it=book_num.find(n);
if(it==book_num.end())
{
return -1;
}
else
{
if(flag==1) cout<<book_v[it->second]<<endl;
return it->second;
} }
void Work::bookfind_name(string n)
{
multimap<string,int>::iterator it;
it=book_name.find(n);
if(it==book_name.end())
{
return;
}
else
{
cout<<book_v[it->second]<<endl;
} }
void Work::bookfind_press(string n)
{
multimap<string,int>::iterator i;
pair<multimap<string,int>::iterator,multimap<string,int>::iterator> range;
range=book_press.equal_range(n);
for(i=range.first;i!=range.second;i++)
{
cout<<book_v[i->second]<<endl;
} }
void Work::bookfind_date(date d)
{
multimap<date,int>::iterator i;
pair<multimap<date,int>::iterator,multimap<date,int>::iterator> range;
range=book_date.equal_range(d);
if (range.first==book_date.end()) return;
i=range.first;
do{
//cout<<i->second<<endl;
cout<<book_v[i->second];
}while(i++!=range.second);
}
void Work::bookfind_date_range(date d1,date d2)
{
multimap<date,int>::iterator it1,it2,it;
it1=book_date.lower_bound(d1);
it2=book_date.upper_bound(d2);
//
for(it=it1;it!=it2;it++)
{
cout<<it->second<<endl;
cout<<book_v[it->second]<<endl;
} }
void Work::book_correct(string n,books &b)
{
multimap<string,int>::iterator it;
it = book_num.find(n);
if(it==book_num.end())
{
//cout<<"ffffff"<<endl;
return;
}
else
{
int a = it->second;
//it=book_num.erase(it);
//book_num.insert(make_pair(b.getbook_num(), book_num.size() - 1));
book_v[a] = b;
//for(int i=0;i<book_v.size();i++)
//cout<<book_v[i]<<endl;
renewBookMap();
//book_w();
} }
void Work::bookfind_vague(string n)
{
multimap<string,int>::iterator it;
for (it = book_name.begin(); it != book_name.end(); it++)
{
string m = it->first;
int a = it->second; int k=0;
for (int i = 0; i < m.size(); i++)
{
for (int j = 0; j < n.size(); j++)
{
if (m[i] == n[j])
k++;
}
}
if (k >= n.size())
{
cout << book_v[a] << endl;
}
} }
void Work::find_bookandwriter(string b_name, string w_name)
{
bool k1, k2 = false;
vector<books>::iterator it1, it2;
for (it1 = book_v.begin(); it1 < book_v.end(); it1++)
{
if (it1->getbook_name() == b_name)
{
k1 = true;
it2 = it1;
}
}
if (k1 == false)
{
return;
}
for (it1 = book_v.begin(); it1 < book_v.end(); it1++)
{
if (it1->getbook_writer() == w_name)
{
k2 = true;
}
}
if (k2 == false)
{
return;
}
if (k1 == true && k2 == true)
{
cout << *it2<<endl;
}
else
{
return;
} }
void Work::find_pressandwriter(string b_press, string w_name)
{
bool k1, k2 = false;
vector<books>::iterator it1, it2;
for (it1 = book_v.begin(); it1 < book_v.end(); it1++)
{
if (it1->getbook_press() == b_press)
{
k1 = true;
}
}
if (k1 == false)
{
return;
}
for (it1 = book_v.begin(); it1 < book_v.end(); it1++)
{
if (it1->getbook_writer() == w_name)
{
k2 = true;
it2 = it1;
}
}
if (k2 == false)
{
return;
}
if (k1 == true && k2 == true)
{
cout << *it2<<endl;
}
else
{
return;
} }
void Work::search_booktype(string type)
{
vector<books>::iterator it;
for (it = book_v.begin(); it != book_v.end(); it++)
{
if (it->getbook_type() == type)
{
cout << *it << endl;
}
} }
void Work::search_bookwriter(string writer)
{
vector<books>::iterator it;
for (it = book_v.begin(); it != book_v.end(); it++)
{
if (it->getbook_writer() == writer)
{
cout << *it << endl;
}
} }
// Borrowing record operation class
// Borrowing records : Include date 、 Book number 、 Reader student number 、 type ( Lend / Return / Renew (a library book) )、 Book types ( Basics / Literary leisure / major );
class Records_operate
{
private:
vector<records>record_v;
multimap<string, int>book_num_v;
multimap<string, int>stu_records;
multimap<date, int> opDate;
public:
~Records_operate()
{
records_w();
}
Records_operate()
{
records_r();
}
Records_operate(records r)
{
record_v.push_back(r);
records_r();
}
void records_r();
void records_w();
void records_add(records &r);
void findrecord_book_num(string n);
void findstu_id_record(string n);
void findRecBydate(date &d);
void findRecBydateRange(date &d1,date &d2);
};
void Records_operate::records_r()
{
records record;
ifstream ifs("2021213057record.txt");
if(!ifs)
return;
while(ifs>>record) // Here ifs>>record If the file can be read normally, it is true , The opposite is false
// Allied , If ifs>>record>>client>>balance Wait a series as a condition , Then these can be read normally , Count as true , On the contrary, it is false .
{
record_v.push_back(record);
book_num_v.insert(make_pair(record.getbook_num(), record_v.size()-1));
stu_records.insert(make_pair(record.getuu_id(), record_v.size()- 1));
opDate.insert(make_pair(record.getdate(), record_v.size()- 1));
}
ifs.close();
}
void Records_operate::records_w()
{
fstream ofs("2021213057record.txt",ios::out);
vector<records>::iterator it;
for(it=record_v.begin();it!=record_v.end();it++)
{
ofs<<*it;
}
ofs.close();
}
void Records_operate::records_add(records &r)
{
record_v.push_back(r);
book_num_v.insert(make_pair(r.getbook_num(), record_v.size() - 1));
stu_records.insert(make_pair(r.getuu_id(), record_v.size() - 1));
opDate.insert(make_pair(r.getdate(), record_v.size()- 1));
}
void Records_operate::findrecord_book_num(string n)
{
multimap<string, int>::iterator it;
it = book_num_v.find(n);
if (it == book_num_v.end())
{
return;
}
else
{
cout << record_v[it->second];
} }
void Records_operate::findstu_id_record(string n)
{
multimap<string, int>::iterator it;
for (it = stu_records.lower_bound(n); it != stu_records.upper_bound(n); it++)
{
cout << record_v[it->second];
} }
void Records_operate::findRecBydateRange(date &d1,date &d2)
{
multimap<date,int>::iterator it1,it2,it;
it1=opDate.lower_bound(d1);
it2=opDate.upper_bound(d2);
//
for(it=it1;it!=it2;it++)
{
//cout<<it->second<<endl;
cout<<record_v[it->second];
} }
void Records_operate::findRecBydate(date &d)
{
multimap<date,int>::iterator i;
pair<multimap<date,int>::iterator,multimap<date,int>::iterator> range;
range=opDate.equal_range(d);
if(range.first==opDate.end()) return;
i=range.first;
do{
cout<<record_v[i->second];
}while(i++!=range.second);
}
void testDate()
{
/* Test the pre day class : Including mm / DD / yyyy , When overloading the input operator , The validity of the data shall be checked ; When overloading the output operator , according to “ year / month / Japan ”
In the form of output ; heavy load + Operator ;
*/
date test1(2022, 4, 29);
cout << test1 << endl;
test1 = test1 + 100;
cout << test1 << endl;
cout << endl;
}
void testBook()
{
// Test books : Book number 、 Title 、 author 、 Press. 、 Publication date 、 Book types ( Basics / Literary leisure / major )、 Total collection 、 Number of in the Museum 、
Borrowing record vector ;
books test4;
date test1(2022, 4, 29);
books b1("20212103", " linear algebra C", " Tianbole ", " China Agriculture Press ", test1, " major ", 10, 1);
test4.setbook_writer(" Tianbole ");
test4.setbook_type(" major ");
test4.setbook_sum(1);
test4.setbook_nowsum(1000);
test4.setbook_press(" China Agriculture Press ");
test4.setbook_pdate(test1);
test4.setbook_num("10101010");
test4.setbook_name(" linear algebra C");
//test4.addlog(test4);
//cout << test4.getbook_num() << " " << test4.getbook_name() << " " << test4.getbook_pdate() << " " <<
test4.getbook_press() << " " << test4.getbook_writer() << " " << test4.getbook_nowsum() << " " << test4.getbook_sum() << endl;
cout<<test4<<endl;
}
void testRecords()
{
// Test borrowing record class : Include date 、 Book number 、 Reader student number 、 type ( Lend / Return / Renew (a library book) )、 Book types ( Basics / Literary leisure / major );
date test1(2022, 4, 29);
records test2;
test2.setbook_num("ISBN 978-7-115-56010-6-1");
test2.setbook_type(" Literary leisure ");
test2.setdate(test1);
test2.setuu_id("2020202021");
test2.setuu_type(" Renew (a library book) ");
cout<<test2<<endl;
}
void testRecords_operate()
{
date jh_d(2018, 8, 1);
date zz_d(2020, 1, 3);
date zs_d(2021, 7, 2);
date gs_d(2021, 3, 4);
records zs_r(zs_d, "ISBN-978-7-115-56050-6-1", "2021214096", " Renew (a library book) ", " major ");
records jh_r(jh_d, "ISBN-978-7-109-24290-6-1", "2021213057", " Lend ", " major ");
records zz_r(zz_d, "ISBN-978-7-109-28070-0-1", "2021213456", " Exchange for ", " major ");
records gs_r(zs_d, "ISBN-978-986-479-477-5-2", "2021214096", " Lend ", " major ");
Records_operate R1;
//R1.records_add(jh_r);
//R1.records_add(zz_r);
//R1.records_add(gs_r);
/*R1.findrecord_book_num("ISBN-978-7-109-28070-0-1");// Query borrowing records by book number
cout<<endl;
R1.findstu_id_record("2021214096");// Query borrowing records by student number
cout<<endl;cout<<endl;*/
R1.findRecBydate(gs_d);
cout<<endl;
R1.findRecBydateRange(jh_d,zs_d);
}
void testWork()
{
/******************************* Test operation class ********************************/
date jh_d(2018, 8, 1);
date zz_d(2020, 1, 3);
date zs_d(2021, 7, 2);
date gs_d(2021, 3, 4);
date d1(1951);
date d2(1957);
date d3(2009);
date d4(2018);
date d5(2019);
date d6(2020);
date d7(2021);
date d8(2022);
date d;
records zs_r(zs_d, "ISBN-978-7-115-56050-6-1", "2021214096", " Renew (a library book) ", " major ");
records jh_r(jh_d, "ISBN-978-7-109-24290-6-1", "2021213057", " Lend ", " major ");
records zz_r(zz_d, "ISBN-978-7-109-28070-0-1", "2021213456", " Exchange for ", " major ");
records gs_r(gs_d, "ISBN-978-986-479-477-5-2", "2021214096", " Lend ", " major ");
books jh_b("ISBN-978-7-109-24290-6", " Basic chemistry experiment ", " Zhang Lili ", " China Forestry Press ", d4, " major ", 100, 50);
books zz_b("ISBN-978-7-109-24290-8", " Botany experiment ", " Zhangzuolin ", " China Agriculture Press ", d5, " major ", 18, 6);
books zs_b("ISBN-978-7-109-24234-1", " biochemistry ", " Meng Wei ", " China Agriculture Press ", d6, " major ", 11, 6);
books gs_b("ISBN-978-986-479-477-5", " Advanced mathematics AAA", " Tianbole ", " China Agriculture Press ", d4, " major ", 12, 3);
books gc_c("ISBN-978-986-479-437-5", " Advanced mathematics C", " Tianbole ", " China Agriculture Press ", d7, " major ", 52, 43);
books gs_c("ISBN-978-986-479-477-9", " The first volume of selected works of Mao Zedong ", " Mao Zedong ", " China Agriculture Press ", d, " major ", 2, 1);
books mx1("ISBN-978-986-479-473-2", " Selected works of Mao Zedong, Volume II ", " Mao Zedong ", " People's Publishing House ", d1, " major ", 14, 2);
books mx2("ISBN-978-986-479-474-5", " Volume III of selected works of Mao Zedong ", " Mao Zedong ", " People's Publishing House ", d1, " major ", 13, 4);
books mx3("ISBN-978-986-479-476-6", " Volume IV of selected works of Mao Zedong ", " Mao Zedong ", " People's Publishing House ", d1, " major ", 15, 6);
books mx4("ISBN-978-986-479-787-7", " Selected works of Mao Zedong Vol. 5 ", " Mao Zedong ", " People's Publishing House ", d2, " major ", 11, 3);
books mx5("ISBN-978-986-479-496-9", " Zhu Longji answered reporters' questions ", " Zhulongji ", " People's Publishing House ", d3, " Basics ", 1, 0);
books test("1234", " Need modification ", " Need modification ", " Need modification ", 2022, " modify ", 0, 0);
Work w_1;
//w_1.book_correct("ISBN-978-986-479-477-5", gs_b);
// w_1.book_del("ISBN-978-986-479-477-5");
//w_1.book_a(test);
/*
w_1.book_a(zz_b);
w_1.book_a(zs_b);
w_1.book_a(gs_b);
w_1.book_a(gs_c);
w_1.book_a(gc_c);
w_1.book_a(mx1);
w_1.book_a(mx2);
w_1.book_a(mx3);
w_1.book_a(mx4);
w_1.book_a(mx5);
*/
w_1.bookfind_date(d8);
cout<<"fff"<<endl;
w_1.bookfind_date(d7);
w_1.bookfind_num("ISBN-978-7-109-24234-1",1);
w_1.bookfind_name(" Botany experiment ");
w_1.bookfind_press(" People's Publishing House ");
w_1.bookfind_vague(" biological ");
w_1.bookfind_num("ISBN-978-986-479-477-5",1);
w_1.find_bookandwriter(" Advanced mathematics A", " Tianbole ");// Book name + author
w_1.find_pressandwriter(" China Agriculture Press ", " Zhangzuolin ");// Press. + author
w_1.bookfind_date_range(d4,d8);// Query time period
w_1.search_booktype(" Basics ");// Query by type
w_1.search_bookwriter(" Tianbole ");// Query by author */
// Call the borrowing record operation class
Records_operate R1;
/*
records zs_r(zs_d, "ISBN-978-7-115-56050-6-1", "2021214096", " Renew (a library book) ", " major ");
records jh_r(jh_d, "ISBN-978-7-109-24290-6-1", "2021213057", " Lend ", " major ");
records zz_r(zz_d, "ISBN-978-7-109-28070-0-1", "2021213456", " Exchange for ", " major ");
records gs_r(zs_d, "ISBN-978-986-479-477-5-2", "2021214096", " Lend ", " major ");
R1.records_add(jh_r);
R1.records_add(zz_r);
R1.records_add(gs_r);*/
R1.findrecord_book_num("ISBN-978-7-109-28070-0-1");// Query borrowing records by book number
cout<<endl;
R1.findstu_id_record("2021214096");// Query borrowing records by student number
cout<<endl;cout<<endl;
R1.findRecBydate(gs_d);
cout<<endl;
R1.findRecBydateRange(jh_d,zs_d);
}
int main()
{
//testDate();
//testReader();
//testBook();
//testRecords();
//testRecords_operate();
testWork();
return 0;
}ifs>>record If the file can be read normally, it is true , The opposite is false
Allied , If ifs>>record>>client>>balance Wait a series as a condition , Then these can be read normally , Count as true , On the contrary, it is false .
Pay attention to understanding while(ifs>>record) This usage .
边栏推荐
- What is FTP? What is the FTP address of the ECS?
- Advanced authentication of uni app [Day12]
- Backup method of mysqldump
- Clang代码覆盖率检测(插桩技术)
- How to monitor the operation of easygbs service in real time?
- Huawei cloud gaussdb (for redis) unveiling issue 19: gaussdb (for redis) comprehensive comparison with CODIS
- Easyanticheat uses to inject unsigned code into a protected process (1)
- Web penetration test - 5. Brute force cracking vulnerability - (8) PostgreSQL password cracking
- 由浅入深的混合精度训练教程
- How to adjust the incompleteness before and after TS slicing of easydss video recording?
猜你喜欢

编译器是如何将芯片执行的第一个指令放到芯片起始地址的?

Jointly build Euler community and share Euler ecology | join hands with Kirin software to create a digital intelligence future

Abnova peptide design and synthesis solutions

mysql - sql执行过程

External network access SVN server (external network access SVN server deployed on the cloud)

博士申请 | 香港科技大学(广州)刘浩老师招收数据挖掘方向全奖博士/硕士

Doctor application | Hong Kong University of science and Technology (Guangzhou) Mr. Liu Hao recruits the full award doctor / Master in data mining

Abnova膜蛋白脂蛋白体解决方案

Multi task video recommendation scheme, baidu engineers' actual combat experience sharing

15+城市道路要素分割应用,用这一个分割模型就够了
随机推荐
apipost接口断言详解
web渗透测试----5、暴力破解漏洞--(9)MS-SQL密码破解
Application practice | Apache Doris integrates iceberg + Flink CDC to build a real-time federated query and analysis architecture integrating lake and warehouse
Next. JS + cloud development webify creates an excellent website
Clang code coverage detection (pile insertion technology)
英特尔 XTU 官方超频工具已支持 Win11 22H2 和 13 代酷睿 Raptor Lake 处理器
mysql - sql执行过程
openEuler Kernel 技术分享第 20 期 | 执行实体创建与切换
Ribbon
ribbon
Worthington脱氧核糖核酸酶I特异性和相关研究
多任务视频推荐方案,百度工程师实战经验分享
From virtual to real, digital technology makes rural funds "live"
web技术分享| 【地图】实现自定义的轨迹回放
Structure size calculation of C language struct
编译器是如何将芯片执行的第一个指令放到芯片起始地址的?
web渗透测试----5、暴力破解漏洞--(8)PostgreSQL密码破解
Tsingsee Qingxi video easycvr integrated Dahua face recognition equipment
Two most practical methods for cadence OrCAD capture to batch modify network names graphic tutorial and video demonstration
web渗透测试----5、暴力破解漏洞--(5)SMB密码破解