📄 card.cpp
字号:
#include"card.h"
int cishu=0;
//|-----------------|
void bsetpd(bookcard &lei)
{lei.pd=0;}
void rsetpd(bookcard &lei)
{lei.pd=1;}
void judge(bookcard &lei)
{
if(lei.pd)
cout<<"the book "<<lei.bookname<<" is in the library"<<endl;
else
cout<<"the book "<<lei.bookname<<" is not in the library"<<endl;
}
//|-----------------|
void bookcard::setbookcard(CString a,CString b,CTime c,double d,CString e)
{
bookname=a; writername=b; publishtime=c; price=d; publishplace=e;
pd=1;
}
void bookcard::getbook()
{
cout<<"书的信息:"<<endl;
cout<<"\t书名:"<<bookname<<"\t作者:"<<writername<<"\t出版日期:"<<publishtime.Format("%Y,%B,%d");
cout<<"\t价钱:"<<price<<"\t出版地点:"<<publishplace<<endl;
}
void borrowcard::setborrowcard(CString a,CString b,CTime c,char d)
{
personname=a; number=b; burntime=c; sex=d;
}
void borrowcard::getperson()
{
cout<<"借书人的信息:"<<endl;
cout<<"\t人名:"<<personname<<"\t性别:"<<sex<<"\t学号:"<<number<<"\t出生日期:"<< burntime.Format("%Y,%B,%d")<<endl;
}
void recordcard::brecord(CTime a,CString b)
{
cout<<"please input the name of the book you want to borrow"<<endl;
cin>>bookname;
while(strcmp(bookname,"sea")&&strcmp(bookname,"picture"))
{
cout<<"你要找的书不存在。请从新输入书名,如果输入三次的书名均不存在,则系统结束"<<endl;
cin>>bookname;
cishu++;
if(cishu==3)
exit(0);
}
cout<<"the book "<<bookname<<" is borrowed"<<endl;
borrowtime=a; personname=b;
}
void recordcard::handle()
{
cout<<"还书时---------------"<<endl;
int year,month,day;
cout<<"please input the time when the book is returned"<<endl;
cin>>year>>month>>day;
returntime=CTime(year,month,day,0,0,0);
CTimeSpan ts=returntime-borrowtime;
cout<<"借书纪录:"<<endl;
cout<<"\t借书时间:"<<borrowtime.Format("%Y,%B,%d");
cout<<"\t借书人:"<<personname<<"\t书名:"<<bookname<<"\t还书时间:"<<returntime.Format("%Y,%B,%d")<<endl;
cout<<"此书已借"<<ts.GetDays()<<"天"<<endl;
if(ts.GetDays()<=30)
cout<<"在规定时间30天内归还"<<endl;
else
cout<<"未在规定时间30天内归还"<<endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -