//陆续更新
#include<bits/stdc++.h>
using namespace std;class Time//时间类,包含年月日时
{
int year;
int month;
int day;
int hour;
public:
Time(int x,int y,int z,int v):year(x),month(y),day(z),hour(v){}
Time(){}
int getYear(){return year;};
int getMonth(){return month;};
int getDay(){return day;};
int getHour(){return hour;};
bool operator<(const Time&d)const
{
return year!=d.year?year<d.year:month!=d.month?month<d.month:day!=d.day?day<d.day:hour<d.hour;
}
friend ostream&operator<<(ostream &os, const Time &d);
friend istream&operator>>(istream &in, Time &d);
};
ostream&operator<<(ostream &os,const Time &d)
{
os<<d.year<<" "<<d.month<<" "<<d.day<<" "<<d.hour;
return os;
}
istream&operator>>(istream &in,Time &d)
{
in>>d.year;
while(1)
{
if(d.year>1000&&d.year<3000)
break;
else
{
cout<<"请输入正确时间"<<endl;
in>>d.year;
}
}
in>>d.month;
while(1)
{
if(d.month>0&&d.month<13)
break;
else
{
cout<<"请输入正确时间"<<endl;
in>>d.month;
}
}
in>>d.day;
while(1)
{
if(d.day>0&&d.day<32)
break;
else
{
cout<<"请输入正确时间"<<endl;
in>>d.day;
}
}
in>>d.hour;
while(1)
{
if(d.hour>-1&&d.hour<25)
break;
else
{
cout<<"请输入正确时间"<<endl;
in>>d.hour;
}
}
return in;
}
class Book//书籍类
{
string name;
string press;
int no;
int number;
int borrow;
int left;
public:
Book(string name1,int no1,string press1,int number1):name(name1),no(no1),press(press1),number(number1){}
Book(){number=0;borrow=0;}
string getName(){return name;};
string getPress(){return press;};
int getNo(){return no;};
int getNumber(){return number;};
int getLeft(){return left;};
friend ostream&operator<<(ostream&os,const Book&b);
friend istream&operator>>(istream&in,Book&b);
};
istream&operator>>(istream&in,Book&b)
{
in>>b.name>>b.no>>b.press>>b.number;
return in;
}
ostream&operator<<(ostream&os,const Book&b)
{
os<<b.name<<" "<<b.no<<" "<<b.press<<" "<<b.number;
return os;
}
class Record//一条记录对应一个人一本书
{
string name;
int id;
Time start;
Time end;
Book b;
bool either;
Time changeEnd;
public:
Record(Time t1,Time t2,Book B1,bool e);
Record(){}
Time getStart(){return start;};
Time getEnd(){return end;};
int getId(){return id;};
string getName(){return name;};
friend ostream&operator<<(ostream&os,const Record&r);
friend istream&operator>>(istream&in,Record&r);
};
istream&operator>>(istream&in,Record&r)
{
in>>r.start>>r.end>>r.b;
in>>r.either;
if(r.either==1)
{
cin>>r.changeEnd;
in>>r.changeEnd;
}
return in;
}
ostream&operator<<(ostream&os,const Record&r)
{
os<<"图书信息"<<endl<<r.b<<endl<<"开始时间"<<endl<<r.start<<endl<<"终止时间"<<endl<<r.changeEnd;
return os;
}
Record::Record(Time t1,Time t2,Book b1,bool e)
{
start=t1;
end=t2;
b=b1;
either=e;
changeEnd=end;
}
class User
{
string name;
string major;
string classes;
int id;
int borrows;
int nowBorrows;
bool breaks;
vector<Record>r;
vector<Record>::iterator it;
multimap<int,int>m1;
multimap<int,int>::iterator m1p;
multimap<string,int>m2;
multimap<int,int>::iterator m2p;
public:
User(){borrows=10;breaks=0;nowBorrows=0;}
void addOne();
void addSome();
int getNowBorrows(){return borrows;};
int getBreaks(){return breaks;};
void addBreaks(int m){breaks+=m;};
friend istream&operator>>(istream&in,User &u);
friend ostream&operator<<(ostream&os,User &u);
void show();
};
void User::addOne()
{
Record r1;
cin>>r1;
r.push_back(r1);
int i=r.size();
m2.insert(make_pair(r1.getName(),i-1));
}
void User::show()
{
for(it=r.begin();it!=r.end();it++)
{
cout<<*it<<endl;
}
}
istream&operator>>(istream&in,User &u)
{
in>>u.id>>u.name>>u.major>>u.classes>>u.nowBorrows>>u.breaks;
return in;
}
ostream&operator<<(ostream&os,User &u)
{
os<<"学号"<<" "<<"姓名"<<"专业"<<" "<<"班级"<<" "<<"当前借阅数"<<" "<<"违规数"<<endl;
os<<u.id<<" "<<u.name<<" "<<u.major<<" "<<u.classes<<" "<<u.nowBorrows<<" "<<u.breaks<<endl;
}
int main()
{
/*Time t;
cin>>t;
cout<<t;
Book b;
cin>>b;
cout<<b;
Record r;
cin>>r;
cout<<r;*/
}