{ system(" cls ");
CNode * pNode
CTelRecord * pTel
char szName[20],szNumber[20],kind[20],writer[20];
Cout & lt& lt" \n\t\t ◇ Please enter a book title (enter 0 to end): ";
cin.getline (szName,20);
while(strcmp(szName," 0 "))
{
Cout & lt& lt" \t\t ◇ Please enter the ISBN: ";
cin.getline(szNumber,20);
Cout & lt& lt" \t\t ◇ Please enter the book type (social science, self-taught examination, literature, reference books, others): ";
cin.getline(kind,20);
Cout & lt& lt" \t\t ◇ Please enter the author's name: ";
cin.getline(writer,20);
pTel = new CTelRecord
pTel-& gt; SetRecord(szName,szNumber,kind,writer);
PNode = new CNode
pNode-& gt; Input data (ptel);
TelList。 add node(pNode);
System ("CLS");
Cout & lt& lt" \n\t\t ☆ Please enter a title (enter 0 to end): ";
cin.getline(szName,20);
}
cout & lt& ltendl & lt& ltendl
}
void display record(CList & amp; TelList)
{ system(" cls ");
cout & lt& ltendl & lt& ltsetw( 15)& lt; & lt"☆Title☆;" & lt; & ltsetw( 15)& lt; & lt" \t☆ ISBN ☆ " & lt; & ltsetw( 15)& lt; & lt" \t ☆ Book types ☆ " & lt; & ltsetw( 15)& lt; & lt" \t ☆ Author ☆\ n "<<;; endl
TelList。 ShowList();
cout & lt& ltendl & lt& ltendl
}
void lookup record(CList & amp; TelList)
{ system(" cls ");
CNode * pLook
char SZ name[20];
Cout & lt< "\ n \ t \ t ☆ Please enter the title of the book you are looking for (enter 0 to end)";
cin.getline(szName,20);
while(strcmp(szName," 0 "))
{
CTelRecord tele(szName," 0 "," 0 "," 0 ");
pLook=TelList。 Look up (telephone);
If (pLook)
{
cout & lt& ltendl & lt& lt" \ t \ t。 ※
cout & lt& ltendl & lt& ltsetw( 15)& lt; & lt"☆Title☆;" & lt; & ltsetw( 15)& lt; & lt" \t☆ ISBN ☆ " & lt; & ltsetw( 15)& lt; & lt" \t ☆ Book types ☆ " & lt; & ltsetw( 15)& lt; & lt" \t ☆ Author ☆\ n "<<;; endl
pLook-& gt; ShowNode();
}
other
cout & lt& lt" \n\t\t! ! ! Can't find "
System ("suspended");
System ("CLS");
Cout & lt< "\ n \ t \ t ☆ Please enter the title of the book you are looking for (enter 0 to end)";
cin.getline(szName,20);
}
cout & lt& ltendl & lt& ltendl
}
void DeleteRecord(CList & amp; TelList)
{ system(" cls ");
CNode * pLook
char SZ name[20];
Cout & lt< "\ n \ t \ t△ Please enter the title of the book you want to delete (enter 0 to end)";
cin.getline(szName,20);
while (strcmp(szName," 0 "))
{
CTelRecord tele (szName," 0 "," 0 "," 0 ");
pLook=TelList。 Look up (telephone);
If (pLook)
{
Cout & lt& lt" \n\t\t☆ Found the record "< & ltszName & lt& lt" in it, which reads: \ n
cout & lt& ltendl & lt& ltsetw( 15)& lt; & lt"☆Title☆;" & lt; & ltsetw( 15)& lt; & lt" \t☆ ISBN ☆ " & lt; & ltsetw( 15)& lt; & lt" \t ☆ Book types ☆ " & lt; & ltsetw( 15)& lt; & lt" \t ☆ Author ☆\ n "<<;; endl
pLook-& gt; ShowNode();
TelList。 delete node(pLook);
cout & lt& lt" \ n \ t \ t◎;" & lt; The data of & ltszName & lt& lt "has been deleted"
}
other
Cout & lt& lt" \n\t\t▲ Sorry, I can't find "< & ltszName & lt& lt" ."& lt& ltendl.
System ("suspended");
System ("CLS");
Cout & lt< "\ n \ t \ t△ Please enter the title of the book you want to delete (enter 0 to end)";
cin.getline(szName,20);
}
cout & lt& ltendl & lt& ltendl
}
void store file(CList & amp; TelList)
{
ofstream outfile("BOOK.dat ",IOs::binary);
If (! Output file)
{
cout & lt& lt" \t\t\t! ! ! Error opening data file, unable to store data ";
Return;
}
CNode * pnode
CTelRecord * pTel
String strName, strNumber
pnode=TelList。 getlist head();
while(pnode)
{
pTel =(CTelRecord *)pnode-& gt; get data();
outfile.write((char *)pTel,sizeof(CTelRecord));
pnode=TelList。 GetListNextNode(pnode); }
outfile . close();
}
Invalid operation (string & ampstrChoice, CList & ampTelList)
Clist & Amptellist;
if(strChoice==" 1 ")
add record(TelList);
else if(strChoice=="2 ")
display record(TelList);
else if(strChoice=="3 ")
lookup record(TelList);
else if(strChoice=="4 ")
DeleteRecord(TelList);
else if(strChoice=="5 ")
Tongji (Tellist);
else if(strChoice=="0 ")
store file(TelList);
other
cout & lt& lt" \n\t\t\t! ! ! Input error, please re-enter your choice. ”< & ltendl
}
void LoadFile(CList & amp; TelList)
{
ifstream infile("BOOK.dat ",IOs::binary);
If (! infile)
{
cout & lt& lt" \n\t\t! ! ! Sorry, the data file was not found, so the data cannot be imported. ”;
Return;
}
CNode * pNode
CTelRecord * pTel
And (! infile.eof())
{
pTel = new CTelRecord
infile.read((char *)pTel,sizeof(ctel record));
PNode = new CNode
pNode-& gt; Input data (ptel);
TelList。 add node(pNode);
}
TelList。 delete node(pNode);
infile . close();
}
Void Tongji (CList & ampTelList)
{ system(" cls ");
int a,b,I,j,k,d,e,f,g,m,n;
CTelRecord sk("0 ","0 ","social science ","0 ");
CTelRecord zk("0 "," 0 "," Zike "," 0 ");
CTelRecord wx("0 ","0 ","literature ","0 ");
CTelRecord gj("0 ","0 ","reference book ","0 ");
CTelRecord qt("0 ","0 ","other ","0 ");
A=TelList. Tongji (sk);
B=TelList. Tongji (ZK);
I=TelList. Tongji (wx);
J=TelList. Tongji (GJ);
k = tellist . Tongji(Qt);
cout & lt& lt\ t ' & lt& lt“↑”& lt; & ltendl
for(d = 20; d & gt0; d-)cout & lt; & ltd+50 & lt; & lt\ t ' & lt& lt"│" & lt; & ltendl
For (d=50, e=50, f=50, g=50, m=50, n = 50e>0; d -,e -,f -,g -,m -,n -)
{ cout & lt& ltd & lt& lt\ t ' & lt& lt"│";
If (e & gta)cout & lt; & lt" "; else cout & lt& lt"■";
cout & lt& lt\ t ';
if(f & gt; b)cout<。 & lt" "; else cout & lt& lt"■";
cout & lt& lt\ t ';
if(g & gt; I)cout & lt; & lt" "; else cout & lt& lt"■";
cout & lt& lt\ t ';
If (m & gtj)cout & lt; & lt" "; else cout & lt& lt"■";
cout & lt& lt\ t ';
If (n & gtk)cout & lt; & lt" "; else cout & lt& lt"■";
cout & lt& ltendl
}
cout & lt& lt“——————————”& lt; & ltendl
Cout & lt< \ t'<<A< ""< \ t'<<b< ""< \ t'<< me< ""<< \ t ' & lt& ltj & lt& lt" " " & lt& lt\ t ' & lt& ltk & lt& lt" " " & lt& ltendl
Cout & lt& lt" ""<& lt "social science"
}
int main()
{
CList TelList
System ("CLS");
Cout & lt& ltendl & lt& lt" \ t \ t \ t ☆☆ Welcome to the library management system ☆☆\ n ";;
LoadFile(TelList);
String strChoice
do
{
cout & lt& ltendl & lt& lt" \ n \ t \ t,※ 1。 Add book record \ n "<& ltendl
cout & lt& lt”\ t \ t \ t,※2。 Show book information \ n "<& ltendl
cout & lt& lt" \ t \ t \ t。 ※。 Search book information by title \ n "<& ltendl
cout & lt& lt" \ t \ t \ t。 ※。 Delete book information according to title \ n "<& ltendl
cout & lt& lt”\ t \ t \ t 5。 Print book information chart \ n "<& ltendl
Cout & lt& lt" \ t \ t \ t tExecute 0. Exit the system "
Cout & lt< "\ t \ t ★ Please enter your choice:";
CIN & gt; & gtstrChoice
CIN . ignore();
Operate(strChoice,TelList);
} while (strChoice! ="0");
Cout & lt& lt“\ n \ n \ t \ t ※※※※ Welcome to the library management system ※※※※※ \ n \ n ";
Returns 0;
}
The above is the code of each part. Please tidy yourself up.