• 大小: 3.03MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-27
  • 语言: C/C++
  • 标签: 图书馆  C++  

资源简介

完整的C++图书馆管理系统程序,初学者的良好练习题目

资源截图

代码片段和文件信息

#include “book.h“  
using namespace std;


int book::Book_bo(int readId)  //借书函数
{
        if (Borrowed == -1) 
{ cout <<“\n\t对不起,您所要借的书不存在 !!!\n“  ; return 0; } 
if (Borrowed != 0)  
{
if (Booking && (Borrowed == readId)) Booking = 0; 
else { cout <<“\n\t您所要借的书已被借走或预约了 !!!\n“ ;return 0; }
}     
else Borrowed = readId;  
return 1;
}

int book::Book_re(int readId) //还书函数
{
if (Borrowed == -1) { cout <<“\n\t您所要还的书不存在 !!!\n“ ; return 0; }
if (Borrowed != readId) { cout <<“\n\t您并没有借这本书 !!!\n“; return 0; }
else  Borrowed = 0;
return 1;
}

int book::Book_ap(int readId)  //预约函数
{
        if (Borrowed == -1) 
{ cout <<“\n\t对不起,您所要借的书不存在 !!!\n“  ; return 0; }
if (Borrowed != 0)  
{
if (Booking && (Borrowed == readId)) 
{ cout <<“\n\t对不起 您已经预约此书 !!!\n“;
  return 0; }
else { cout <<“\n\t对不起 此书已被借走或预约 !!!\n“ ;return 0; }
}     
else { Borrowed = readId; Booking = 1; }
return 1;
}

int book::Book_add(const string s1 const string s2const string s3const string s4int s5int s6int s7) //初始化图书信息
{
ISBN   = s1; Name   = s2;
writer = s3; Index = s4;
Borrowed = s5; BookID = s6;
Booking = s7;
return 0;
}

int book::Display()                             //输出书目的相关信息
{
cout << setw(10) << BookID << 
    setw(10) << ISBN <<
setw(15) << Name <<
setw(15) << writer <<
setw(15) << Index;
    if (Borrowed!=0) 
{
if (Booking==0) cout << setw(10) << “已借“;
else cout << setw(10) << “已预约“;
}
cout << endl;
return 0;
}
 

int book::Book_delete()                       //删除书目
{
if (Borrowed > 0) 
{
for (int i = 0; i < USER.size(); i++) 
if (Borrowed==USER[i].UserID)

cout <<“\n\t您不能删除这本书,因为这本书已被人借或预约\n“;
return 0; 
}        //如果这本书有人借,就无法删除
}
Borrowed = - 1;
cout <<“\n\t您已经成功删除此书!\n“;
return 0;
}



 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2062  2008-12-28 15:10  library\book.cpp

     文件        928  2008-12-28 15:09  library\book.h

     文件        540  2008-12-28 15:22  library\operate3.cpp

     文件     115712  2008-12-28 15:34  library\Debug\vc60.idb

     文件    1644943  2008-12-18 16:08  library\Debug\DataBook.txt

     文件        115  2003-12-27 22:56  library\Debug\DataUser.txt

     文件    1644943  2008-12-18 16:08  library\Debug\InitBook.txt

     文件        115  2003-12-27 22:56  library\Debug\InitUser.txt

     文件     143360  2008-12-28 15:34  library\Debug\vc60.pdb

     文件    2546376  2008-12-28 15:34  library\Debug\library.pch

     文件     158914  2008-12-28 15:34  library\Debug\book.obj

     文件     465677  2008-12-28 15:34  library\Debug\main.obj

     文件     112476  2008-12-28 15:34  library\Debug\operate1.obj

     文件     114874  2008-12-28 15:34  library\Debug\operate2.obj

     文件      35971  2008-12-28 15:34  library\Debug\operate3.obj

     文件     141640  2008-12-28 15:34  library\Debug\operate4.obj

     文件     149628  2008-12-28 15:34  library\Debug\operate5.obj

     文件     149403  2008-12-28 15:34  library\Debug\operate6.obj

     文件     175601  2008-12-28 15:34  library\Debug\user.obj

     文件    1091348  2008-12-28 15:34  library\Debug\library.ilk

     文件     725079  2008-12-28 15:34  library\Debug\library.exe

     文件    1287168  2008-12-28 15:34  library\Debug\library.pdb

     文件        101  2008-12-28 13:34  library\operate6.h

     文件    1644943  2008-12-18 16:08  library\InitBook.txt

     文件        115  2008-12-22 13:00  library\InitUser.txt

     文件       5243  2008-12-28 15:05  library\main.cpp

     文件        539  2003-12-27 22:40  library\library.dsw

     文件      82944  2008-12-28 15:34  library\library.ncb

     文件       1216  2008-12-28 15:34  library\operate2.cpp

     文件       2130  2008-12-28 15:34  library\library.plg

............此处省略22个文件信息

评论

共有 条评论