資源簡介
圖書信息管理系統(tǒng)圖書信息管理系統(tǒng)圖書信息管理系統(tǒng)圖書信息管理系統(tǒng)圖書信息管理系統(tǒng)圖書信息管理系統(tǒng)

代碼片段和文件信息
//?tushuguanli.cpp?:?Defines?the?entry?point?for?the?console?application.
//
#include?//字符串頭文件
#include?//文件頭文件
#include?//是指標準庫中輸入輸出流的頭文件?cout就定義在這個頭文件里
using?namespace?std;//使用名字空間std
const?int?BMAX=50;???//書最多個數(shù)
//圖書管理模塊
//圖書類
class?book
{
public:
int?no;??????????????????????????????????????//圖書編號
char?name[20];???????????????????????????????//圖書名稱
int?b_flag;??????????????????????????????????//1為在架,2為借出
int?b_del;???????????????????????????????????//1為存在?2為刪除
public?:
book(){}???????????????????????????????//構(gòu)造函數(shù)
void?setno(int?n)
{
no=n;?????????????????????????????//圖書編號取值
}
int?getno()
{
return?no;???????????//返回圖書編號值
}
void?setname(char?na[])
{
strcpy(name?na);???//字符串復(fù)制
}
char*?getname()
{
return?name;??//返回圖書名稱
}
void?borbook()
{
b_flag=2;?????//借書標志
}
void?delbook()
{
b_del=2;???//刪除標志
}
void?addbook(int?nochar?na[])????//增加圖書功能
{
setno(no);
setname(na);
b_flag=1;
b_del=1;
}
}
;
//圖書數(shù)據(jù)庫類
class?bdatabase
{
public:
book?btarray[BMAX];?????????????????????????????????????????//圖書集合
int?top;
public:
bdatabase()
{
book?b;?
top=-1;?
fstream?file(“book.txt“ios::in);????//打開文件
while?(1)?
{?
file.read((char?*)&bsizeof(b));?
if?(!file)?break;?
top++;?
btarray[top]?=?b;?
}?
file.close();? ?//關(guān)閉文件
}
~bdatabase()??????????????????????//析構(gòu)函數(shù),????將btarray[]寫到book.txt文件中?
{?
fstream?file(“book.txt“ios::out);?
for?(int?i=0;i<=top;i++)
{
if?(btarray[i].b_del==1)?
file.write((char?*)&btarray[i]sizeof(btarray[i]));?
}
file.close();?
}?
void?addbooks()?????????????????????????????????????//往圖書數(shù)據(jù)庫中加圖書
{
book?bk;
int?no;
char?bname[20];
cout<<“請輸入書號:?“;
cin>>no;
cout< cin>>bname;
cout< bk.b_flag=1;
bk.addbook(no?bname);
top++;
btarray[top]=bk;
return;
}
int?findbooks(int?suffix)????????//查找圖書,這個函數(shù)用于借書這書操作,suffix是數(shù)組下標
{
int?no;
cout<<“請輸入書號:?“;
cin>>no;
for(int?i=0;?i<=top;?i++)
{
if(btarray[i].no==no?&&?btarray[i].b_del==1)
{
return?i;
}
}
return?-1;
}
int?findbooks()????????????????????????????????//查找圖書這個函數(shù)用于圖書維護??
{
int?no;
char?value[6];
cout<<“請輸入書號:?“;
cin>>no;
for(int?i=0;?i<=top;?i++)
{
if(btarray[i].no==no?&&?btarray[i].b_del==1)
{
if(btarray[i].b_flag==1)?strcpy(value“在架“);
if(btarray[i].b_flag==2)?strcpy(value“借出“);
cout<<“書號:?“< return?i;
}
}
return?-1;
}
void?editbooks()??????????????????????????????????????????//編輯圖書
{
int?cur;
cur?=?findbooks();
if?(cur==-1)
{ cout<<“沒有這本書“< return;
}
cout<<“書號:?“<
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2011-09-26?20:39??圖書信息管理系統(tǒng)\
?????文件???????11657??2011-09-24?16:49??圖書信息管理系統(tǒng)\Book?System.cpp
?????文件????????3563??2011-09-23?11:22??圖書信息管理系統(tǒng)\Book?System.dsp
?????文件?????????530??2011-09-23?11:22??圖書信息管理系統(tǒng)\Book?System.dsw
?????文件???????58368??2011-09-23?11:22??圖書信息管理系統(tǒng)\Book?System.ncb
?????文件???????49664??2011-09-23?11:22??圖書信息管理系統(tǒng)\Book?System.opt
?????文件?????????908??2011-09-23?10:18??圖書信息管理系統(tǒng)\Book?System.plg
?????文件???????????0??2011-09-23?09:26??圖書信息管理系統(tǒng)\book.txt
?????目錄???????????0??2011-09-26?20:39??圖書信息管理系統(tǒng)\Debug\
?????文件??????295936??2011-09-23?09:20??圖書信息管理系統(tǒng)\Debug\Book?System.bsc
?????文件??????594033??2011-09-23?09:20??圖書信息管理系統(tǒng)\Debug\Book?System.exe
?????文件??????835020??2011-09-23?09:20??圖書信息管理系統(tǒng)\Debug\Book?System.ilk
?????文件??????404976??2011-09-23?09:20??圖書信息管理系統(tǒng)\Debug\Book?System.obj
?????文件?????2222708??2011-09-23?09:20??圖書信息管理系統(tǒng)\Debug\Book?System.pch
?????文件?????1156096??2011-09-23?09:20??圖書信息管理系統(tǒng)\Debug\Book?System.pdb
?????文件???????????0??2011-09-23?09:20??圖書信息管理系統(tǒng)\Debug\Book?System.sbr
?????文件??????????64??2011-09-19?21:26??圖書信息管理系統(tǒng)\Debug\book.txt
?????文件???????99999??2011-09-23?10:18??圖書信息管理系統(tǒng)\Debug\t.sbr
?????文件??????123904??2011-09-23?10:18??圖書信息管理系統(tǒng)\Debug\vc60.idb
?????文件??????118784??2011-09-23?10:18??圖書信息管理系統(tǒng)\Debug\vc60.pdb
?????文件???????????0??2011-09-23?09:26??圖書信息管理系統(tǒng)\reader.txt
評論
共有 條評論