图书管理实验报告001Word格式文档下载.docx
- 文档编号:5297469
- 上传时间:2023-05-04
- 格式:DOCX
- 页数:18
- 大小:38.84KB
图书管理实验报告001Word格式文档下载.docx
《图书管理实验报告001Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《图书管理实验报告001Word格式文档下载.docx(18页珍藏版)》请在冰点文库上搜索。
5)每借出一本图书或归还一本图书之后,输出书库内图书情况或借书人登记资料,以便可对操作是否完成;
6)书库内没有登记的图书,不能办理借阅手续.当然,不是在改图书库借出的图书业不能在此处办理还书手续.
源程序代码:
#include<
iostream.h>
stdio.h>
conio.h>
string.h>
stdlib.h>
structDate//日期数据结构
{intyear;
intmonth;
intday;
};
structPerson//个人信息数据结构
{charname[20];
longtele;
//thetelephonenumber
Datedateb;
//声明dateb是structData成员
structBook//图书资料信息数据结构
{longISBN;
//书号
charBname[31];
//书名
charBwrite[20];
//作者名
charBprint[31];
//出版社名
char*Bkeyword[5];
//关键词
Book*link;
//指向下一连节点
Personmessage;
//声明message是structPerson类型)
classLibrary//图书馆类
{protected:
Book*librin;
//在书库链
Book*libout;
//借书链
public:
Library();
//构造函数
~Library();
//析构函数
voidcreat();
//创建图书馆
voidprint1();
//输出在书库图书
voidinquire1();
//书号查询
voidinquire2();
//书名查询
voidinquire3();
//关键词查询
voidborrow();
//借书
voidprint2();
//输出借出图书
voidinvert();
//还书
voidurge();
//催还图书
voiddeleter();
//删除图书
voidinsert();
//增加新书
Library:
:
Library()//构造函数
{libout=NULL;
}
~Library()//析构函数
{;
}
intdayth(intY,intM,intD)//计算某年某月某日是当年第几天
{intdy=0;
M=M-1;
while(M>
0)
{do
{
if(M==2)
{if(((Y%4==0)&
&
(Y%100!
=0))||((Y%400==0)))
dy=dy+29;
elsedy=dy+28;
}
else
{if(((M<
=7)&
(M%2==1))||((M>
=8)&
(M%2==0)))
dy=dy+31;
elsedy=dy+30;
}
M=M-1;
}while(M>
0);
}
dy=dy+D;
returndy;
intYmday(intY,intM)//判断某年某月有几天
{if(M==2)
{if(((Y%4==0)&
=0))||(Y%400==0))return29;
elsereturn28;
else
{if(((M<
(M%2==0)))return31;
elsereturn30;
intYeardays(inty)//判断某年有几天
{if((y%4==0&
y%100!
=0)||(y%400==0))return366;
elsereturn365;
longLeapdays(intyy1,intyy2)//计算某年两年之间相距多少天
{longy,m,d=0;
while(yy1<
yy2)
{m=Yeardays(yy1);
d=d+m;
yy1++;
returnd;
voidLibrary:
creat()//创建图书资料函数
{
Book*h,*q,*p,*temp,*k;
inti=1,j;
h=NULL;
p=newBook;
if(p==NULL){cout<
"
\n\tEorror!
"
;
exit
(1);
}
q=p;
cout<
\n\t---TheBookInfornation---\n"
\n\nNO."
i;
do{
cout<
\n\tInputtheISBN(0toend):
cin>
p->
ISBN;
if(p->
ISBN<
0)
\n\tTheISBNilledal!
ISBN==0)break;
}while(p->
=0);
if(p->
ISBN>
{
cout<
\n\tInputtheBname:
gets(p->
Bname);
\n\tInputtheBwrite:
Bwrite);
\n\tInputtheBprint:
Bprint);
\n\tInputtheBkeyword:
(InputtheNULLtoend)"
for(j=0;
j<
5;
j++)
{
\n\tNO."
j+1<
(InputtheNULLtoend):
p->
Bkeyword[j]=newchar[20+1];
gets(p->
Bkeyword[j]);
if(strcmp(p->
Bkeyword[j],"
)==0)
break;
}
q->
link=NULL;
while(p->
ISBN!
=0)
{i++;
if(h==NULL)h=p;
if(i>
2)
{temp=h;
while(p->
temp->
ISBN&
link!
=NULL)
{k=temp;
temp=temp->
link;
if(p->
=temp->
ISBN)
{
if(temp==h)
{p->
link=temp;
h=p;
else
{k->
link=p;
}
else
{temp->
}
p=newBook;
cout<
do{
cout<
\n\tInputtheISBN(0toend):
cin>
if(p->
\n\tTheISBNillegal!
}while(p->
0);
if(p->
0)
{
cout<
\n\tIputtheBname:
gets(p->
for(j=0;
{cout<
p->
gets(p->
if(strcmp(p->
)==0)break;
}
q=p;
librin=h;
}//creatend
print1()//输出在书库图书资料函数
{intj;
Book*p;
p=librin;
if(librin==NULL)cout<
\n\tThelistisNULL!
else
do{
if(p->
ISBN==0)continue;
\n_______________________________________________________\n"
\nNO."
ISBN<
\nBname:
Bname;
\nBwrite:
Bwrite<
\nBprint:
Bprint;
\nBkeyword:
\n"
//getch();
if(strcmp(p->
)!
=0)
\t"
Bkeyword[j];
elsebreak;
//getch();
p=p->
getch();
}while(p!
=NULL);
}//print1end
inquire1()//书号查询函数
{longnum;
intj;
Book*temp;
temp=librin;
if(librin==NULL)
{cout<
\n\tThislistisNULL!
exit
(1);
else
{
\n\tInputyouneedseekISBN:
cin>
num;
while(num!
=temp->
ISBN&
temp->
=NULL)
temp=temp->
if(num==temp->
{cout<
\n\tYourneedresultis:
for(j=0;
{
if(strcmp(temp->
cout<
elsebreak;
}
}
else
cout<
\n\tSorry,SeekFailure!
getch();
}//inquire1end
inquire2()//书名查询函数
{charname[30+1];
intj;
Book*temp;
\n\tInputyouneedseekBname:
gets(name);
while((strcmp(temp->
Bname,name)!
=0)&
if(strcmp(name,temp->
Bname)==0)
if(strcmp(temp->
cout<
elsebreak;
else
cout<
\n\tSoory,SeekFailure!
getch();
}//inquire2end
inquire3()//关键词查询函数
{char*keyword[5];
inti=0,j,d,ct=0,k=0;
\n\tInputyouneedSeekBkeyword:
keyword[j]=newchar[20+1];
i++;
gets(keyword[j]);
if(strcmp(keyword[j],"
)==0)
break;
d=i;
while(temp!
ct=0;
for(j=0;
d;
{for(i=0;
strcmp(temp->
Bkeyword[i],"
=0&
i<
i++)
if(strcmp(keyword[j],temp->
Bkeyword[i])==0)
{ ct++;
break;
if(strcmp(temp->
)==0||i>
=5)break;
if(ct==(d-1))
{k++;
cout<
for(j=0;
cout<
if(k==0)
cout<
getch();
}//inquire3end
borrow()///借书函数
{Book*p,*temp,*h,*st;
longnum;
{cout<
\n\tThelibraryisNULL!
return;
p=libout;
\n\tInputyourneedtheISBN:
cin>
while(temp->
=num&
{st=temp;
temp=temp->
}//Scanning
if(temp->
ISBN==num)
{if(temp==librin)librin=librin->
elsest->
link=temp->
\n\tInputtheYourname:
gets(temp->
message.name);
\n\tInputthetelephonenumber:
cin>
message.tele;
do
{cout<
\n\tInputtheyear(1900<
=y<
=2100)
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 图书 管理 实验 报告 001