图书馆管理系统数据库设计 第5页

图书馆管理系统数据库设计 第5页
cout<<"\n\t\t◎"<<szName<<"的资料已删除"<<endl;
}
else
cout<<"\n\t\t▲对不起, 在里面找不到 "<<szName<<" ."<<endl;
system("pause");
system("cls");
cout<<"\n\t\t△请输入您想要删除的书名(输入0结束)";
cin.getline(szName ,20);
}
cout<<endl<<endl;
}
void StoreFile(CList &TelList)
{
ofstream outfile("BOOK.dat",ios::binary);
if(!outfile)
{
cout<<"\t\t\t !!! 数据文件打开错误,无法储存数据";
return;
}
CNode *pnode;
CTelRecord *pTel;
string strName,strNumber;
pnode=TelList.GetListHead();
while(pnode)
{
pTel=(CTelRecord *)pnode->GetData();
outfile.write((char *)pTel,sizeof(CTelRecord));
pnode=TelList.GetListNextNode(pnode); }
outfile.close();
}
void Operate(string &strChoice,CList &TelList)
{ void TongJi(CList &TelList);
if(strChoice=="1")
AddRecord(TelList);
else if(strChoice=="2")
DisplayRecord(TelList);
else if(strChoice=="3")
LookUpRecord(TelList);
else if(strChoice=="4")
DeleteRecord(TelList);
else if(strChoice=="5")
TongJi(TelList);
else if(strChoice=="0")
StoreFile(TelList);
else
cout<<"\n\t\t\t !!!输入错误,请重新输入您的选择."<<endl;
}
void LoadFile(CList &TelList)

{
ifstream infile("BOOK.dat",ios::binary);
if(!infile)
{
cout<<"\n\t\t !!!对不起,没有找到数据文件,无法导入数据.";
return;
}

CNode*pNode;
CTelRecord*pTel;
while(!infile.eof())
{
pTel=new CTelRecord;
infile.read((char *)pTel,sizeof(CTelRecord));
pNode=new CNode;
pNode->InputData(pTel);
TelList.AddNode(pNode);

}

TelList.DeleteNode(pNode);
infile.close();
}
void TongJi(CList &TelList)

{ system("cls");
int a,b,i,j,k, d,e,f,g,m,n;
CTelRecord sk("0","0","社科","0");
CTelRecord zk("0","0","自科","0");
CTelRecord wx("0","0","文学","0");
CTelRecord gj("0","0","工具书","0");
CTelRecord qt("0","0","其他","0");

a=TelList.tongji(sk);
b=TelList.tongji(zk);
i=TelList.tongji(wx);
j=TelList.tongji(gj);
k=TelList.tongji(qt);

cout<<'\t'<<"↑"<<endl;
for(d=20;d>0;d--)cout<<d+50<<'\t'<<"│"<<endl;
for(d=50,e=50,f=50,g=50,m=50,n=50;e>0;d--,e--,f--,g--,m--,n--)
{ cout<<d<<'\t'<<"│";
if(e>a)cout<<" ";else cout<<"■";
cout<<'\t';
if(f>b)cout<<" ";else cout<<"■";
cout<<'\t';
if(g>i)cout<<" ";else cout<<"■";
cout<<'\t';
if(m>j)cout<<" ";else cout<<"■";
cout<<'\t';
if(n>k)cout<<" ";else cout<<"■";
cout<<endl;
}
cout<<" ————————————————————————→"<<endl;
cout<<'\t'<<a<<" "<<'\t'<<b<<" "<<'\t'<<i<<" "<<'\t'<<j<<" "<<'\t'<<k<<" "<<endl;
cout<<" "<<"社科"<<" "<<"自科"<<" "<<"文学"<<" "<<"工具书"<<" "<<"其他"<<endl;

}
int main()
{
CList TelList;
system("cls");
cout<<endl<<"\t\t\t☆☆☆ 欢迎进入图书管理系统☆☆☆\n";
LoadFile(TelList);
string strChoice;
do

上一页  [1] [2] [3] [4] [5] [6] 下一页

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有