圖書館資訊管理系統——》你說這是你的大作業?>>>C++專案實戰

2022-01-04 22:00:16

前言:你說這是你的大作業?>>>雖然看起來很簡單,很普通,但它確實是大作業在這裡插入圖片描述
,你可以從中發現無限樂趣…
ヾ(◍°∇°◍)ノ゙——

【1】客戶需求描述(題目描述):

在這裡插入圖片描述
在這裡插入圖片描述
在這裡插入圖片描述
在這裡插入圖片描述

【2】難點分析:

難點1️⃣(題目本身)

  • 最開始看到這個作業時,我是很不以為然的,畢竟都是提前自學過的了( •̀ ω •́ )✧,可——

  • 我還是太弱小了ಥ_ಥ

  • 看看這變態需求

  • 1:支援巨量資料,比如書籍記錄突破百萬,使用者數量突破萬級規模

  • 2:搜尋時效能考察,調查、思考、設計加強搜尋效能的方式

  • 3.樣本資料

在這裡插入圖片描述

難點2️⃣(卷神同學)

  • 同學A😎:我要用Qt,做一個。

很多同學不知道Qt是什麼,這裡簡單地介紹一下。
在這裡插入圖片描述> < 這是Qt的軟體
這:你可以在Codeblock看到它
在這裡插入圖片描述
這是簡單的介面,他教我寫的
在這裡插入圖片描述

還有…

  • 同學B😼:我要創個桌面程式!!!

可能還有朋友不知道C++怎麼弄桌面應用
看這裡——
在這裡插入圖片描述
`

  • 同學C😈:你們都在程式設計,我整個網頁

他自學了前端,學了HTML,還參加過網頁設計比賽
這是他發給我的軟體
在這裡插入圖片描述
在這裡插入圖片描述

  • 同學D👻:mySQL選手

這個是我猜的≡(▔﹏▔)≡
學院那麼大,來個學完資料庫的同學,不過分吧》》》》
在這裡插入圖片描述
我都來不及裝軟體ヽ(≧□≦)ノ

在這裡插入圖片描述





【3】開始——

世界縱已內卷,程式設計不容躺平
在這裡插入圖片描述
程式設計必須強!!!💥🐉





【4】程式碼實現:

注:使用CB編寫,VS需要重寫時間函數
Libray(圖書館),Labray屬拼寫錯誤

1️⃣Labray.h

#ifndef LABRAY_H
#define LABRAY_H

#include<iostream>
#include<string>
#include<cstring>
#include<windows.h>
#include<functional>
#include<algorithm>
using namespace std;
#include<vector>
#include<ctime>
#include<unordered_map>
//----------------------------------參照的庫
//介面美化
void toxy(int x, int y);    //將遊標移動到X,Y座標處
void SetColorAndBackground(int ForgC, int BackC);  //設定顏色
//----------------------
//-------圖書類,管理員類,讀者類的設定
class Book {
public:
	string Book_name;
	string IBSN;
	string writer;
	string classify;
    int cur_num;
	Book() {}
	Book(string n,string i,string w,string c,int num):Book_name(n),IBSN(i),writer(w),classify(c),cur_num(num){}
};
class Administrator
{
	friend class Labray;
public:
	string a_account;
	string a_code;
	Administrator() {};
	Administrator(string account, string code) :a_account(account), a_code(code) {}
};
class User
{
	friend class Labray;
public:
	string u_account;
	string u_code;
	unordered_map<string,int>u_memo;
	unordered_map<string,int>u_back_memo;
	User(){};
	User(string account, string code) :u_account(account), u_code(code) {}
};
//-------
//------------------------------
class Labray
{
private:
	unordered_map<string, Administrator>Admins;//用雜湊表查詢,更加快
	unordered_map<string, User>Users;
	vector<Book>tmbook;
	vector<string>Borrow_memo;
    vector<string>Back_memo;
	string Landed_accout="0";//C++11標準,可直接這樣初始化用,這裡使用是為了後面的部分操作
	//---------------------------
	void init_book();
	void init_Admin();
	void init_User();
	void init_Borrow_memo();
	void init_Back_memo();
	void Save_Book();
	void Save_Admins();
	void Save_Users();
	void Save_Borrow_memo();
	void Save_Back_memo();
	//----------------------
    void Search_thebook();
	void myover(); //強制退出
	//---------------------
	void AdminStart();
	void UserStart();
	string getCur_time();
public:
	Labray();
	void Landing();
};
#endif // LABRAY_H

2️⃣Labray.cpp

#include "Labray.h"
#include<windows.h>
#include<fstream>
constexpr auto Bookfile = "H_books.txt";
constexpr auto Adminfile = "Admins.txt";
constexpr auto Usersfile = "users.txt";
constexpr auto Borrowfile="Borrow_memo.txt";
constexpr auto Backfile="Back_memo.txt";

//----------------------------------輔助函數,幫助查詢
class help_find{//,輔助find_if查詢,無需泛型程式設計,就不用寫模板
private:
    string name; //你可以用介面卡,只要你能正確匹配函數即可
public:
    help_find(string t_name):name(t_name){};
	bool operator()(const Book& book) {
		if (book.Book_name == name)return true;
		else return false;
	}
};
int str_to_num(string str){
    int jie=0;
for(int i=0;i<str.size();i++){
   jie=jie*10+(str[i]-'0');
}
return jie;
}
//-----------------------------------------------------設定
void SetColorAndBackground(int ForgC, int BackC) {
	WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wColor);
}


void toxy(int x, int y)      //將遊標移動到X,Y座標處
{
	COORD pos = { x , y };
	HANDLE Out = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition(Out, pos);
return ;
}
//對介面設定函數的定義,這兩個函數,記住就行了,現階段不要求理解
//----------------------------------------------------
//--獲取時間
string Labray::getCur_time(){
	time_t t;    //typedef long time_t;
	time(&t);    //獲取系統時間
	char* str = ctime(&t);  //將時間t轉換為字串
	return str;
}
//-------------------關鍵的建構函式,初始化
Labray::Labray(){
	ifstream ifs1;
	ifs1.open(Bookfile, ios::in);
	if (!ifs1.is_open()) {//情況一:檔案未建立,即檔案不存在
			//初始化屬性
		cout << "-----------------------------------------------------" << endl;
		cout << "提示:--!!!圖書資訊檔案未建立,執行系統可自動生成檔案!!! --" << endl;
		cout << "-----------------------------------------------------" << endl;
		ifs1.close();
		return;
	}
	//2.檔案存在,但資料為空
	char ch;
	ifs1 >> ch;
	if (ifs1.eof()) {
		cout << "--------------------------------------------------------" << endl;
		cout << "提示:--!!!圖書館尚無存書,等待管理員新增圖書!!!--" << endl;
		cout << "--------------------------------------------------------" << endl;
		ifs1.close();
		return;
	}
	//圖書館有圖書,我們需要把檔案中的圖書資訊讀到程式中
	ifs1.close();
	this->init_book();
	this->init_Admin();
	this->init_User();
	this->init_Borrow_memo();
	this->init_Back_memo();
	SetColorAndBackground(1,0);
	cout << "-------------------------   " << endl;
	cout << "[H]系統現有【使用者人數】為:" << this->Users.size() << endl;
	cout << "[H]系統現有【管理員人數】為:" << this->Admins.size() << endl;
    cout << "[H]系統現有【圖書種類】為:" << this->tmbook.size() << endl;
	cout << "-------------------------   " << endl;
	SetColorAndBackground(7,0);
	cout << endl;
}
//---------------------
void Labray:: Save_Book() {
	//儲存圖書檔案
		ofstream ofs;
		ofs.open(Bookfile, ios::out);//寫檔案
		//將每個人的資料寫入檔案中
		for (int i = 0; i < this->tmbook.size(); i++) {
			ofs << this->tmbook[i].Book_name << ' '
				<< this->tmbook[i].IBSN << ' '
				<< this->tmbook[i].writer<<' '<<
				this->tmbook[i].classify <<' '<<this->tmbook[i].cur_num<<endl;
		}
		ofs.close();
		return;
}
void Labray::Save_Admins() {
	ofstream ofs;
	ofs.open(Adminfile, ios::out);//寫檔案
	//將每個人的資料寫入檔案中
	for (pair<string,Administrator> it:this->Admins) {
		ofs << it.second.a_account << ' '
			<< it.second.a_code<< endl;
	}
	ofs.close();
	return;
}
void Labray::Save_Users() {
	ofstream ofs;
	ofs.open(Usersfile, ios::out);//寫檔案
	//將每個人的資料寫入檔案中
	for (pair<string, User> it : this->Users) {
		ofs << it.second.u_account << ' '
			<< it.second.u_code << endl;
	}
	ofs.close();
	return;
}
void Labray::Save_Borrow_memo(){
    ofstream ofs;
    ofs.open(Borrowfile,ios::out);
    //寫入借閱記錄
    for(string it:this->Borrow_memo){
        ofs<<it<<endl;
    }
    ofs.close();
    return;
}
void Labray::Save_Back_memo(){
    ofstream ofs;
    ofs.open(Backfile,ios::out);
    //寫入借閱記錄
    for(string it:this->Back_memo){
        ofs<<it<<endl;
    }
    ofs.close();
    return;
}
void  Labray::init_book() {
	ifstream ifs;
	ifs.open(Bookfile, ios::in);
	string name;
	string IBSN;
	string writer;
	string classify;
	string tmp_cur_num;
	while (ifs >>name && ifs >>IBSN && ifs >>writer && ifs >>classify && ifs >>tmp_cur_num) {
        int cur_num=str_to_num(tmp_cur_num);
        Book tmp(name,IBSN,writer,classify,cur_num);
		this->tmbook.push_back(tmp);
	}
	ifs.close();
	return;
}
void Labray::init_Admin() {
	ifstream ifs;
	ifs.open(Adminfile, ios::in);
	string account, code;
	while (ifs >> account && ifs >>code) {
        Administrator tmp(account,code);
		this->Admins[tmp.a_account]=tmp;
	}
	ifs.close();
	if(this->Admins.empty()){
        Administrator tmp("20220101","123456");
        this->Admins["20220101"]=tmp;//新增預設管理員
        this->Save_Admins();
	}
	return;
}
void Labray::init_User() {
	ifstream ifs;
	ifs.open(Usersfile, ios::in);
	string account;
	string code;
	while (ifs >> account && ifs >> code) {
		User tmp(account,code);
		this->Users[tmp.u_account] = tmp;
	}
	ifs.close();
	return;
}
void Labray::init_Borrow_memo() {
	ifstream ifs;
	ifs.open(Borrowfile, ios::in);
	string informantion;
	while (getline(ifs,informantion)) {
      this->Borrow_memo.push_back(informantion);
	}
	ifs.close();
	return;
}
void Labray::init_Back_memo() {
	ifstream ifs;
	ifs.open(Backfile, ios::in);
	string informantion;
	while (getline(ifs,informantion)) {
      this->Back_memo.push_back(informantion);
	}
	ifs.close();
	return;
}
//以上實現檔案互動
//--------------------------------------------------
//---------
void Labray::myover(){
	Sleep(500);
	float x,y,a;
    for(y=1.5;y>-1.5;y-=0.1){
        for(x=-1.35;x<1.5;x+=0.05){
           a=x*x+y*y-1;
           putchar(a*a*a-x*x*y*y*y<0.0?'*':' ');
      }
     system("color 0c");
     putchar('\n');
   }
   cout << "歡迎下次使用!!!" << endl;
   exit(0);
}
void Labray::Landing() {
	cout << "-----------------------------------------------------" << endl;
	cout << "-------------歡迎使用《H_de圖書館系統》---------------" << endl;
	cout << "-----------------------------------------------------" << endl;
	cout << "請選擇--登陸模式:" << endl;
	SetColorAndBackground(6,4);
	cout << endl;
    cout << "》】-------------------【《" << endl;//畫個小老虎
    cout << "|           王            |" << endl;
	cout << "| ----             -----  |" << endl;
	cout << "|  |0                0|   |" << endl;
	cout << "|          [][]           |" << endl;
	cout << "|---------vvvvvv----------|" << endl;
	cout << "|-------------------------|" << endl;
	cout<<endl;
    SetColorAndBackground(7,0);
	BigFlag:cout << "請輸入你的登陸模式——pleace input you choice!!!" << endl;
	cout<<"******************************"<<endl;
	cout <<"-[0]------管理員登陸--/;"<<endl;
	cout<<"-[1]---------讀者登陸/;"<<endl;
	cout<<"-[2]--------註冊使用者賬號/;" << endl;
	cout<<"******************************"<<endl;
	char flag = '0';
	cin >> flag;//登陸分流的標識
	string you_account;
	string you_code;
	//---------管理員身份
	if (flag=='0') {
	Flag0:
	      SetColorAndBackground(9,0);
		  cout << "      ------------------------------------------------" << endl;
	      cout << "                》》》管理員登陸《《《                " << endl;
		  cout << "      ------------------------------------------------" << endl;
		  SetColorAndBackground(7,0);
        string jd="0";
        cout<<"選項..."<<endl;
        cout<<"退出程式——【輸0】"<<endl;
        cout<<"繼續程式——【非0】"<<endl;
        cout<<"輸入選項..."<<endl;
        cin>>jd;
        if(jd=="0")this->myover();
	      cout << "      請輸入你的賬號(教師編號/學生學號):...." << endl;
          cout << "      ------------------------------------------------" << endl;
	      cin >> you_account;
          Sleep(500);
	      cout << "      ------------------------------------------------" << endl;
		  cout << "      請輸入你的密碼(使用者預設密碼為123456)...." << endl;
		  cout << "      ------------------------------------------------" << endl;
		  cin >> you_code;
		  cout << "   ------------------------------------------------" << endl;
		if (!this->Admins.count(you_account)) {
            SetColorAndBackground(7,4);
			cout << "    沒有該賬戶存在!!!" << endl;
            SetColorAndBackground(7,0);
			system("pause");
			system("cls");
			goto Flag0;
		}
		else {
			if (this->Admins[you_account].a_code != you_code) {
                SetColorAndBackground(7,4);
				cout << "》》賬號存在,但密碼錯誤《《" << endl;
                SetColorAndBackground(7,0);
				system("pause");
				system("cls");
				goto Flag0;
			}
			else {
                SetColorAndBackground(4,0);
				cout << "!!歡迎使用管理員身份登陸系統!!" << endl;
				this->Landed_accout = you_account;
				this->AdminStart();
			}
		}
	}
	//---------讀者身份
	else if(flag=='1') {
	Flag1:
	    SetColorAndBackground(9,0);
        cout << "        -----------------------------------------------------" << endl;
	    cout << "             》》》讀者登陸《《《                          " << endl;
		cout << "        -----------------------------------------------------" << endl;
        SetColorAndBackground(7,0);
        string jd="0";
        cout<<"選項..."<<endl;
        cout<<"退出程式——【輸0】"<<endl;
        cout<<"繼續程式——【非0】"<<endl;
        cout<<"輸入選項..."<<endl;
        cin>>jd;
        if(jd=="0")this->myover();
        Sleep(500);
		cout << "        請輸入你的賬號(教師編號/學生學號):...." << endl;
		cout << "        -----------------------------------------------------" << endl;
		cin >> you_account;
        Sleep(500);
		cout << "        -----------------------------------------------------" << endl;
		cout << "        請輸入你的密碼(使用者預設密碼為123456)...." << endl;
		cout << "        -----------------------------------------------------" << endl;
		cin >> you_code;
		cout << "        -----------------------------------------------------" << endl;
		if (!this->Users.count(you_account)) {
			cout << "沒有該賬戶存在!!!" << endl;
			system("pause");
			system("cls");
			goto Flag1;
		}
		else {
			if (this->Users[you_account].u_code != you_code) {
				cout << "》》賬號存在,但密碼錯誤《《" << endl;
				system("pause");
				system("cls");
				goto Flag1;
			}
			else {
                SetColorAndBackground(4,0);
				cout << "!!歡迎使用學生身份登陸系統!!" << endl;
				this->Landed_accout = you_account;
				this->UserStart();
			}
		}
	}
	else if(flag=='2') {
        SetColorAndBackground(4,6);
		cout << "=================================" << endl;
		cout << "提示:歡迎您註冊HNU圖書館系統賬號" << endl;
		cout << "=================================" << endl;
        SetColorAndBackground(7,0);
        string jd="0";
        cout<<"選項..."<<endl;
        cout<<"退出程式——【輸0】"<<endl;
        cout<<"繼續程式——【非0】"<<endl;
        cout<<"輸入選項..."<<endl;
        cin>>jd;
        if(jd=="0")this->myover();
		string you_U_account;
		cout << "請輸入您的賬號....." << endl;
		cin >> you_U_account;
		if(this->Users.count(you_U_account)){
            cout<<"已有該賬號存在,本次操作自動復原!"<<endl;
		}else{
		  cout << "請輸入您的密碼....." << endl;
          string you_U_code;
		  cin >> you_U_code;
		  User tmp(you_U_account, you_U_code);
		  this->Users[you_U_account] = tmp;
		  this->Save_Users();
		  cout << "註冊成功!請重新登陸系統." << endl;
		  flag = '1';
		}
		system("pause");
		system("cls");
		goto Flag1;
	}
	else {
        SetColorAndBackground(0,6);
		cout << "警告!!!選項輸入錯誤!請重新輸入" << endl;
        SetColorAndBackground(7,0);
		system("pause");
		system("cls");
		goto BigFlag;
	}
}
//----------------------------------------------------------------------------------------------------
//難點圖書查詢
void  Labray::Search_thebook() {

	Flag:
    cout << "檢索方式:::::::[A].書名(匹配檢索) [B].作者名(匹配檢索) "<<endl;
    cout<<"[C].IBSN/ISSN(精確檢索) [D].分類號(精確檢索)  [E]資訊精確搜尋  [F]分類號(模糊檢索) " << endl;
	cout << "輸入檢索選項......" << endl;
	char ch;
    cin >> ch;
	if (ch == 'A') {
		string Bname;
		cout << "請輸入您要檢索的圖書名稱..." << endl;
		cin >> Bname;
		bool flag=0;
		for (Book it : tmbook) {
			if (it.Book_name.find(Bname)!=string::npos) {
				if(!flag)cout << "檢索結果如下>>>>" << endl;
				flag = 1;
				cout <<"《"<< it.Book_name<<"》" << ' ' << it.IBSN << ' ' << it.writer << ' ' << it.classify<<' '<<"現有數量:" <<it.cur_num<< endl;
		 }
		}
		if (!flag) {
			cout << "未找到相關圖書!" << endl;
		}
	}
//------------------------------------------------------
	else if (ch == 'B') {
		string writer_name;
		cout << "請輸入您要檢索的圖書的作者/編者/譯者名稱..." << endl;
		cin >> writer_name;
		bool flag = 0;
		for (Book it : tmbook) {
			if (it.writer.find(writer_name)!=string::npos) {
				if (!flag)cout << "檢索結果如下>>>>" << endl;
				flag = 1;
				cout <<"《"<< it.Book_name<<"》" << ' ' << it.IBSN << ' ' << it.writer << ' ' << it.classify<<' '<<"現有數量:" <<it.cur_num<< endl;
			}
		}
		if (!flag) {
			cout << "未找到相關作者對應的圖書!" << endl;
		}
	}
	else if (ch == 'C') {
		string the_IBSN;
		cout << "請輸入對應的IBSN/ISSN編號..." << endl;
		cin >> the_IBSN;
		bool flag = 0;
		for (Book it : tmbook) {
			if (it.IBSN ==the_IBSN) {
				if (!flag)cout << "檢索結果如下>>>>" << endl;
				flag = 1;
				cout <<"《"<< it.Book_name<<"》" << ' ' << it.IBSN << ' ' << it.writer << ' ' << it.classify<<' '<<"現有數量:" <<it.cur_num<< endl;
			}
		}
		if (!flag) {
			cout << "未找到相關IBSN/ISSN對應的圖書!" << endl;
		}
	}
	else if (ch == 'D') {
		string the_classify;
		cout << "請輸入對應的分類號!!!" << endl;
		cin >> the_classify;
		bool flag = 0;
		for (Book it : tmbook) {
			if (it.classify == the_classify) {
				if (!flag)cout << "檢索結果如下>>>>" << endl;
				flag = 1;
				cout <<"《"<< it.Book_name<<"》" << ' ' << it.IBSN << ' ' << it.writer << ' ' << it.classify<<' '<<"現有數量:" <<it.cur_num<< endl;
			}
		}
		if (!flag) {
			cout << "未找到相關分類號對應的圖書" << endl;
		}
	}
	else if(ch=='E'){
        cout<<"1s後啟用資訊精確搜尋。輸入一條您已知的關於該圖書的資訊(作者/書名/ISBN...)。系統自動為您搜尋相關結果"<<endl;
        Sleep(1000);
        system("cls");
        SetColorAndBackground(8,0);
    string information;
	toxy(0, 8);
	printf("請輸入您要查詢圖書的資訊:");
	cin >> information;;
	toxy(0, 10);
	printf("正在查詢....");
	Sleep(500);
	int i=12;
	toxy(10, 5);
    printf("***********************************************圖書總覽******************************************************");
	toxy(10, 8);
	printf("-------------------------------------------------------------------------------------------------------------");
	toxy(10, 9);
	printf("            書名                 ISSN/IBSN        作者名         分類號          現有數量                    ");
	toxy(10, 10);
	printf("-------------------------------------------------------------------------------------------------------------");
	bool flag=0;
	cout<<endl;
	for(Book& it:this->tmbook){
        if(it.Book_name==information|| it.IBSN==information || it.writer==information||it.classify==information){
            toxy(10, i);
            flag=1;
		 cout<<"《"<<it.Book_name<<"》"<<"     "<<it.IBSN<<"     "<<it.writer<<"     "<<it.classify<<"num:"<<it.cur_num<<endl;
        }
	}
    if(!flag){
        cout<<"空空如也的查詢結果"<<endl;
        }
        system("pause");
		system("cls");
		goto Flag;
	}
	else if(ch='F'){
        SetColorAndBackground(4,0);
        cout<<"使用分類號模糊搜尋,自動匹配出符合分類條件的書籍。"<<endl;
        SetColorAndBackground(7,0);
        cout<<"分類規則如下:"<<endl;
        cout<<"範例:MA001-AD01-E01,代表 [數學001]-[高等數學01]-[教材01],所代表的圖書是《高等數學教材第1版》"<<endl;
        cout<<"簡要描述:"<<endl;
        cout<<"[1]:每個分類號有三級,其中的[字母]代表[種類],[數位]代表[編號]"<<endl;
        cout<<"[2]:(0,1)字元代表第一個分類號,(6,7)字元代表第二個分類號,(11)字元代表第三個分類號"<<endl;
        cout<<"[3]:數位屬於系統自動編排,不必詳細瞭解其規則。"<<endl;
        cout<<"開始分類號模糊搜尋..."<<endl;
        cout<<"分類號模糊檢索將分三次,依次輸入各級分類,每次輸入一個子分類"<<endl;
        string jd="0";
        cout<<"選項..."<<endl;
        cout<<"終止程式——【輸0】"<<endl;
        cout<<"繼續程式——【非0】"<<endl;
        cout<<"輸入選項..."<<endl;
        cin>>jd;
        if(jd=="0"){
        system("pause");
		system("cls");
		goto Flag;
        }
        string nums_class_1;
        cout<<"請輸入第一級分類號。至少兩位字母+至多位數位.如CD111,正確;AB11111錯誤"<<endl;
        cin>>nums_class_1;
        while(nums_class_1.size()>5){
            cout<<"請重新輸入"<<endl;
            cin>>nums_class_1;
        }
        vector<Book>jie_1;
        for(Book it:this->tmbook){
            string tmp=it.classify.substr(0,5);
            if(tmp.find(nums_class_1)!=string::npos){
                    jie_1.push_back(it);
                    cout<<"《"<<it.Book_name<<"》"<<it.IBSN<<" "<<it.writer<<" "<<it.classify<<"  num:"<<it.cur_num<<endl;
            }
        }
        cout<<"是否需要進入第二級搜尋。"<<endl;
        cout<<"選項..."<<endl;
        cout<<"終止程式——【輸0】"<<endl;
        cout<<"繼續程式——【非0】"<<endl;
        cout<<"輸入選項..."<<endl;
        cin>>jd;
        if(jd=="0"){
        system("pause");
		system("cls");
		goto Flag;
        }
        cout<<"進入第二級搜尋..."<<endl;
        string nums_class_2;
        cout<<"請輸入第二級分類號。至少兩位字母+至多兩位數位.如AB11,正確;A11111錯誤"<<endl;
        cin>>nums_class_2;
        while(nums_class_2.size()>4){
            cout<<"請重新輸入"<<endl;
            cin>>nums_class_2;
        }
        vector<Book>jie_2;
        for(Book it:jie_1){
            string tmp=it.classify.substr(6,4);
            if(tmp.find(nums_class_2)!=string::npos){
                    jie_2.push_back(it);
                    cout<<"《"<<it.Book_name<<"》"<<it.IBSN<<" "<<it.writer<<" "<<it.classify<<"  num:"<<it.cur_num<<endl;
            }
        }
        cout<<"是否需要進入第三級搜尋。"<<endl;
        cout<<"選項..."<<endl;
        cout<<"終止程式——【輸0】"<<endl;
        cout<<"繼續程式——【非0】"<<endl;
        cout<<"輸入選項..."<<endl;
        cin>>jd;
        if(jd=="0"){
        system("pause");
		system("cls");
		goto Flag;
        }
        cout<<"進入第三級搜尋..."<<endl;
        string nums_class_3;
        cout<<"請輸入第三級分類號。至少1位字母+至多兩位數位.如A1,正確;A123錯誤"<<endl;
        cin>>nums_class_3;
        while(true){
            int size3=nums_class_3.size();
            if(size3<=3)break;
            cout<<"請重新輸入"<<endl;
            cin>>nums_class_3;
        }
        vector<Book>jie_3;
        for(Book it:jie_2){
            string tmp=it.classify.substr(11,3);
            if(tmp.find(nums_class_3)!=string::npos){
                    jie_3.push_back(it);
                    cout<<"《"<<it.Book_name<<"》"<<it.IBSN<<" "<<it.writer<<" "<<it.classify<<"  num:"<<it.cur_num<<endl;
            }
        }
        cout<<"三級搜尋完畢。系統自動退出"<<endl;
        Sleep(500);
        system("pause");
		system("cls");
		goto Flag;
	}
	else {
		cout << "輸入錯誤!請重新輸入" << endl;
		system("pause");
		system("cls");
		goto Flag;
	}
	return;
}
//--------------------------------------------------開始管理員的操作
void Labray:: AdminStart() {
   FLAGa: SetColorAndBackground(0,7);
	      cout <<"     ---------------------------------     " << endl;
	      cout <<"        HUN圖書管理系統——管理員模式      " << endl;
	      cout <<"     ---------------------------------     " << endl;
	      cout <<"     *********管理員功能選單**********     " << endl;
	      cout <<"     使用者管理:                             " << endl;
	      cout <<"     》》1:檢視所有使用者賬號及密碼          " << endl;
	      cout <<"     》》2:修改使用者賬號/密碼               " << endl;
	      cout <<"     》》3:初始化使用者賬號/密碼             " << endl;
	      cout <<"     》》4:徹底刪除使用者                    " << endl;
	      cout <<"     -------------------------------       " << endl;
	      cout <<"     圖書管理:                             " << endl;
	      cout <<"     》》5:遊覽全部圖書                    " << endl;
	      cout <<"     》》6:修改圖書資訊                    " << endl;
          cout <<"     》》7.增添圖書資訊                    " << endl;
	      cout <<"     》》8.徹底刪除圖書                    " << endl;
	      cout <<"     》》9.搜尋圖書                        " << endl;
          cout <<"     》》A.檢檢視書借閱記錄                " << endl;
          cout <<"     》》B.檢檢視書歸還記錄                " << endl;
          cout <<"     》》C.清空圖書借閱記錄                " << endl;
          cout <<"     》》D.清空圖書歸還記錄                " << endl;
	      cout <<"     個人類:                              " << endl;
	      cout <<"     》》E.登出賬號                        " << endl;
	      cout <<"     》》F.更改密碼                        " << endl;
          cout <<"     管理員操作:                           " << endl;
	      cout <<"     》》G.檢視所有管理員資訊              " << endl;
	      cout <<"     》》H.新增新的管理員資訊              " << endl;
          cout <<"     》》I.刪除現存管理員資訊              " << endl;
	      cout <<"     ----------------                      " << endl;
          cout <<"     其他:                                 " << endl;
          cout <<"     》》0.退出系統                        " << endl;
	      cout <<"請輸入操作選項!...                        " << endl;
    SetColorAndBackground(7,0);
	char select;
	cin >> select;
	if (select == '1') {
		if (this->Users.empty()) {
            SetColorAndBackground(6,4);
			cout << "不好意思。系統暫無使用者存在!" << endl;
            SetColorAndBackground(7,0);
		}
		else {
			for (pair<string, User> it : this->Users) {
				cout << "使用者賬號:" << it.second.u_account << "  使用者密碼:" << it.second.u_code << endl;
			}
		}
		system("pause");
		system("cls");
		goto FLAGa;
	}
	else if (select == '2') {
		cout << "請輸入您想更改的賬號(使用者名稱)" << endl;
		string the_u_account;
		cin >> the_u_account;
		if (!this->Users.count(the_u_account)) {
            SetColorAndBackground(6,4);
			cout << "系統中沒有該使用者賬號" << endl;
            SetColorAndBackground(7,0);
		}
		else {
			cout << "原密碼:" << this->Users[the_u_account].u_code << endl;
			cout << "請輸入修改後的密碼!......" << endl;
			cin >> this->Users[the_u_account].u_code;
			this->Save_Users();
			cout << "修改完成!!!" << endl;
		}
		system("pause");
		system("cls");
		goto FLAGa;
	}
	else if (select == '3') {
		cout << "請輸入您想初始化的賬號(使用者名稱)" << endl;
		string the_u_account;
		cin >> the_u_account;
		if (!this->Users.count(the_u_account)) {
            SetColorAndBackground(6,4);
			cout << "系統中沒有該使用者賬號" << endl;
            SetColorAndBackground(7,0);
		}
		else {
            SetColorAndBackground(1,0);
			cout << "原密碼:        " << this->Users[the_u_account].u_code << endl;
			cout << "初始化ing......" << endl;
			this->Users[the_u_account].u_code="123456";
			this->Save_Users();
			cout << "修改完成!!! " << endl;
			SetColorAndBackground(7,0);
		}
		system("pause");
		system("cls");
		goto FLAGa;
	}
	else if(select=='4'){
        cout<<"請輸入您要刪除的使用者賬號..."<<endl;
        string t_u_account;
        cin>>t_u_account;
        if(!this->Users.count(t_u_account)){
            cout<<"系統無該使用者賬號,本次操作自動視為取消"<<endl;
            system("pause");
		    system("cls");
		    goto FLAGa;
        }
        else{
            this->Users.erase(t_u_account);
            Sleep(500);
            cout<<"刪除成功!"<<endl;
            system("pause");
		    system("cls");
		    goto FLAGa;
        }
	}
	else if(select=='5'){
    SetColorAndBackground(2,0);
    cout<<"   ***********************************************圖書總覽******************************************************\n";
	cout<<"   -------------------------------------------------------------------------------------------------------------\n";
	cout<<"            書名                 ISSN/IBSN        作者名         分類號          現有數量                       \n";
	cout<<"   -------------------------------------------------------------------------------------------------------------\n";
    for (Book it : this->tmbook) {
		 cout<<"《"<<it.Book_name<<"》"<<"     "<<it.IBSN<<"     "<<it.writer<<"     "<<it.classify<<" num:"<<it.cur_num<<endl;
		}
    SetColorAndBackground(7,0);
    system("pause");
    system("cls");
    goto FLAGa;
	}
	else if (select == '6') {
		cout << "請輸入圖書名稱" << endl;
		string Book_name;
		cin >> Book_name;
		//auto it = this->myFind_use_name(this->tmbook, Book_name);
		auto it=find_if(this->tmbook.begin(),this->tmbook.end(),help_find(Book_name));
		if (it == this->tmbook.end()) {
             SetColorAndBackground(6,4);
             cout << "圖書館暫未存入該圖書" << endl;
             SetColorAndBackground(7,0);
		}
		else {
			cout << "請重新輸入圖書資訊" << endl;
			cout << "IBSN/ISSN...." << endl;
			cin >> it->IBSN;
			cout << "作者..." << endl;
			cin >> it->writer;
			cout << "分類號" << endl;
			cin >> it->classify;
			cout<<"現有圖書數量..."<<endl;
			cin>>it->cur_num;
			this->Save_Book();
			cout << "圖書資訊修改完成" << endl;
		}
		system("pause");
		system("cls");
		goto FLAGa;
	}
	else if (select == '7') {
            cout<<"請錄入新加圖書的資訊...."<<endl;
			string t_name;
			string t_ISBN;
			string t_writer;
			string t_classfiy;
			int t_cur_num;
			cout << "圖書書名...." << endl;
			cin >> t_name;
			auto it = find_if(this->tmbook.begin(),this->tmbook.end(),help_find(t_name));
			if(it!=this->tmbook.end()){
                SetColorAndBackground(1,6);
                cout<<"圖書館內已有同名書籍,請選擇更改圖書資訊或者在書名後加註釋"<<endl;
                SetColorAndBackground(7,0);
			}else{
			cout << "ISBN/ISSN碼..." << endl;
			cin >> t_ISBN;
			cout << "作者/編者/譯者..." << endl;
			cin >> t_writer;
			cout << "分類號..." << endl;
			cin>> t_classfiy;
			cout<<  "加入現有數目..."<<endl;
			cin>>t_cur_num;
			Book tmp(t_name, t_ISBN, t_writer, t_classfiy,t_cur_num);
			this->tmbook.emplace_back(tmp);
		    this->Save_Book();
		    cout << "圖書資訊儲存成功" << endl;
        }
		system("pause");
		system("cls");
		goto FLAGa;
	}
	else if (select == '8') {
		cout << "請輸入您要徹底刪除的圖書名稱!" << endl;
		string t_name;
		cin >> t_name;
		vector<Book>::iterator it;
		for (it = this->tmbook.begin(); it != this->tmbook.end(); it++)
			if (it->Book_name == t_name)break;
		if (it == this->tmbook.end()){
                SetColorAndBackground(0,4);
                cout << "未找到該名稱的圖書,操作自動復原" << endl;
                SetColorAndBackground(7,0);
		}
		else {
			this->tmbook.erase(it);
			this->Save_Book();
			cout << "圖書刪除完畢" << endl;
		}
		system("pause");
		system("cls");
		goto FLAGa;
	}
	else if (select == '9') {
	this->Search_thebook();
	system("pause");
	system("cls");
	goto FLAGa;
    }
    else if(select=='A'){
        if(this->Borrow_memo.empty())cout<<"暫圖書借閱記錄!"<<endl;
        else{
        cout<<"圖書借閱記錄如下..."<<endl;
        for(auto it:this->Borrow_memo)
             cout<<it<<endl;
        }
	system("pause");
	system("cls");
	goto FLAGa;
    }
    else if(select=='B'){
        if(this->Back_memo.empty()){
            cout<<"暫無圖書歸還記錄!"<<endl;
        }
        else{
        cout<<"圖書歸還記錄如下..."<<endl;
        for(auto it:this->Back_memo)
             cout<<it<<endl;
        }
 	system("pause");
	system("cls");
	goto FLAGa;
    }
    else if(select=='C'){
        cout<<"確定要清空圖書借閱記錄嗎?   "<<endl;
        cout<<"【非0】確認    【輸入0】取消"<<endl;
        char jd='0';
        cin>>jd;
        Sleep(500);
        if(jd!='0'){
            this->Borrow_memo.clear();
            this->Save_Borrow_memo();
            cout<<"已完成清空!"<<endl;
        }
        Sleep(500);
       system("pause");
	   system("cls");
	   goto FLAGa;
    }
    else if(select=='D'){
         cout<<"確定要清空圖書歸還記錄嗎?   "<<endl;
        cout<<"【非0】確認    【輸入0】取消"<<endl;
        char jd='0';
        cin>>jd;
        Sleep(500);
        if(jd!='0'){
            this->Back_memo.clear();
            this->Save_Back_memo();
            cout<<"已完成清空!"<<endl;
        }
       Sleep(500);
       system("pause");
	   system("cls");
	   goto FLAGa;
    }
	else if (select == 'E') {
	this->Admins.erase(this->Landed_accout);
	this->Save_Admins();
    SetColorAndBackground(1,6);
	cout << "賬號已成功登出.稍後系統自動退出" << endl;
	SetColorAndBackground(0,7);
	Sleep(500);
	exit(0);
    }
	else if (select == 'F') {
	cout << "請輸入您更改後的密碼" << endl;
	string new_code;
	cin >> new_code;
	this->Admins[this->Landed_accout].a_code = new_code;
	this->Save_Admins();
	cout << "修改成功!" << endl;
	system("pause");
	system("cls");
	goto FLAGa;
    }
	else if (select == '0') {
	this->myover();
    }
    else if(select=='G'){
        for (pair<string, Administrator> it : this->Admins) {
				cout << "管理員賬號:" << it.second.a_account << "  管理員密碼:" << it.second.a_code << endl;
			}
    system("pause");
	system("cls");
	goto FLAGa;
    }
    else if(select=='H'){
        cout<<"*********請輸入您要新增的管理員賬號>>>>"<<endl;
        string t_a_account;
        cin>>t_a_account;
        if(this->Admins.count(t_a_account)){
            cout<<"已有該賬號的管理員,本次操作視為取消"<<endl;
            system("pause");
          	system("cls");
	        goto FLAGa;
        }else{
             cout<<"*********請輸入您要新增的管理員的密碼>>>>"<<endl;
             string t_a_code;
             cin>>t_a_code;
             Administrator tmp(t_a_account,t_a_code);
             this->Admins[t_a_account]=tmp;
             this->Save_Admins();
             cout<<"新增成功."<<endl;
             system("pause");
             system("cls");
	         goto FLAGa;
        }
    }
    else if(select=='I'){
        cout<<"*********請輸入您要刪除的管理員賬號>>>>"<<endl;
        string t_a_account;
        cin>>t_a_account;
        if(!this->Admins.count(t_a_account)){
            cout<<"不存在該賬號的管理員,本次操作視為取消"<<endl;
            system("pause");
          	system("cls");
	        goto FLAGa;
        }else{
             cout<<">>>>>開始刪除....>>>>"<<endl;
             Sleep(500);
             this->Admins.erase(t_a_account);
             this->Save_Admins();
             system("pause");
             system("cls");
	         goto FLAGa;
        }
    }
	else {
    SetColorAndBackground(0,6);
	cout << "選項輸入錯誤,請重新輸入" << endl;
	SetColorAndBackground(0,7);
	system("pause");
	system("cls");
	goto FLAGa;
    }
}
//--------------------------------開始使用者的操作
void Labray::UserStart() {
FLAGu:SetColorAndBackground(0,7);
    cout << "    H_圖書管理系統——使用者模式      " << endl;
	cout << "    -----------------------------    " << endl;
	cout << "    *******使用者功能選單*********     " << endl;
	cout << "    ---------------------------------" << endl;
	cout << "    圖書操作:                        " << endl;
	cout << "    》》1:遊覽全部圖書               " << endl;
	cout << "    》》2.借閱圖書                   " << endl;
	cout << "    》》3.搜尋圖書                   " << endl;
	cout << "    》》4.檢視自己的圖書借閱記錄     " << endl;
	cout << "    》》5.檢視自己的圖書歸還記錄     " << endl;
	cout << "    》》6.部分歸還圖書               " << endl;
    cout << "    》》7.一鍵全部歸還               " << endl;
	cout << "    個人類:                         " << endl;
	cout << "    》》8.登出賬號                   " << endl;
	cout << "    》》9.更改密碼                   " << endl;
	cout << "    其他:                            " << endl;
	cout << "    》》0.退出系統                   " << endl;
	cout << "    ----------------                 " << endl;
	SetColorAndBackground(7,0);
	SetColorAndBackground(7,0);
	cout << "請輸入操作選項!...              " << endl;
	char ch;
	cin >> ch;
	if (ch == '1') {
    SetColorAndBackground(2,0);
    cout<<"   ***********************************************圖書總覽******************************************************\n";
	cout<<"   -------------------------------------------------------------------------------------------------------------\n";
	cout<<"            書名                 ISSN/IBSN        作者名         分類號          現有數量                       \n";
	cout<<"   -------------------------------------------------------------------------------------------------------------\n";
    for (Book it : this->tmbook) {
    cout<<"《"<<it.Book_name<<"》"<<"     "<<it.IBSN<<"     "<<it.writer<<"     "<<it.classify<<" num:"<<it.cur_num<<endl;
    }
    SetColorAndBackground(7,0);
		system("pause");
		system("cls");
		goto FLAGu;
	}
	else if (ch == '2') {
		cout << "您想借閱的圖書書名.一人一次最多借一本" << endl;
		string t_name;
		cin >> t_name;
		auto it = find_if(this->tmbook.begin(),this->tmbook.end(),help_find(t_name));
		if (it != this->tmbook.end()) {
		    cout<<"圖書資訊如下,請確認!"<<endl;
            cout<<"《"<<it->Book_name<<"》"<<"     IBSN:"<<it->IBSN<<"     作者:"<<it->writer<<"     分類號:"<<it->classify<<" num:"<<it->cur_num<<endl;
            Sleep(500);
            if(it->cur_num==0){
                cout<<"抱歉,這本書已經被借走了!"<<endl;
                system("pause");
                system("cls");
		        goto FLAGu;
            }
            char jd='0';
            cout<<"請確認借閱..."<<endl;
            cout<<"|【輸0】——放棄借閱|【非0】——確認借閱"<<endl;
            cout<<"請輸入您的選擇!"<<endl;
            cin>>jd;
            if(jd=='0'){
                cout<<"成功取消本次操作!"<<endl;
                system("pause");
                system("cls");
                goto FLAGu;
            }
            else{
			    cout << "您已成功借得本書,可在借閱記錄中檢視" << endl;
			    this->Users[Landed_accout].u_memo[t_name]++;
			    string JL_borrow_memo="使用者"+Landed_accout+"於"+this->getCur_time()+"借得圖書《"+t_name+"》";
			    this->Borrow_memo.push_back(JL_borrow_memo);
			    it->cur_num--;
			    this->Save_Book();
			    this->Save_Borrow_memo();
                system("pause");
                system("cls");
                goto FLAGu;
              }
		}
		else{
            SetColorAndBackground(6,4);
            cout << "-------------------------"<<endl;
			cout << "抱歉。圖書館暫未收錄本書" << endl;
            cout << "-------------------------"<<endl;
            SetColorAndBackground(0,7);
            system("pause");
		    system("cls");
		    goto FLAGu;
		}
	}
	else if (ch == '3') {
		this->Search_thebook();
		system("pause");
		system("cls");
		goto FLAGu;
	}
	else if (ch == '4') {
		if (this->Users[Landed_accout].u_memo.empty()) {
			cout << "您的借閱空空如也" << endl;
		}
		else {
			cout << "你的借閱記錄如下" << endl;
			for (pair<string,int> it : this->Users[Landed_accout].u_memo) {
				cout <<"《"<<it.first<<"》" <<"  "<<to_string(it.second) << endl;
			}
		}
		system("pause");
		system("cls");
		goto FLAGu;
	}
	else if(ch=='5'){
        if(this->Users[Landed_accout].u_back_memo.empty()){
            cout<<"您暫無歸還記錄!!"<<endl;
        }
        else{
        cout << "你的歸還記錄如下,歡迎繼續借閱" << endl;
			for (pair<string,int> it : this->Users[Landed_accout].u_back_memo) {
                cout <<"《"<<it.first<<"》" <<"  "<<to_string(it.second) << endl;
			}
        }
		system("pause");
		system("cls");
		goto FLAGu;
	}
	else if (ch == '6'){
        if (this->Users[Landed_accout].u_memo.empty()) {
			cout << "您的借閱還未借得書籍,無需歸還" << endl;
		}
		else {
			cout << "你的借閱記錄如下,請選擇您要歸還的書籍名稱" << endl;
			for (pair<string,int> it : this->Users[Landed_accout].u_memo) {
				   cout <<"《"<<it.first<<"》" <<"  "<<to_string(it.second) << endl;
			}
			cout<<"請輸入您要歸還的書籍名稱..."<<endl;
            string book_name;
            cin>>book_name;
            if(!this->Users[Landed_accout].u_memo.count(book_name)){
                    cout<<"您尚未借得該圖書,本次操作視為取消"<<endl;
                    system("pause");
		            system("cls");
		            goto FLAGu;
            }
            cout<<"請輸入你要歸還的書籍數量..."<<endl;
            int book_num;
            cin>>book_num;
            if(this->Users[Landed_accout].u_back_memo[book_name]>book_num){
                cout<<"歸還數量有誤,本次操作視為取消"<<endl;
                system("pause");
                system("cls");
                goto FLAGu;
            }
            vector<Book>::iterator it =find_if(this->tmbook.begin(),this->tmbook.end(),help_find(book_name));
            if(it==this->tmbook.end()){
                    cout<<"圖書館未存該圖書的資訊,輸入錯誤,該操作視為自動復原"<<endl;
                    system("pause");
		            system("cls");
		            goto FLAGu;
            }
            else{
                it->cur_num+=book_num;
                this->Users[Landed_accout].u_memo[book_name]-=book_num;
                string JL_back_memo="使用者"+Landed_accout+"於"+this->getCur_time()+"歸還圖書《"+book_name+"》"+to_string(book_num)+"本";
                this->Users[Landed_accout].u_back_memo[book_name]+=book_num;
                this->Back_memo.push_back(JL_back_memo);
                this->Save_Back_memo();
                this->Save_Book();
                cout<<"歸還完畢!!!"<<endl;
            }
		}
 		system("pause");
		system("cls");
		goto FLAGu;
	}
	else if(ch=='7'){
        cout<<"開始一鍵歸還..."<<endl;
        for(auto it: this->Users[Landed_accout].u_memo){
            if(it.second>0){
             vector<Book>::iterator the_book =find_if(this->tmbook.begin(),this->tmbook.end(),help_find(it.first));
             if(the_book!=this->tmbook.end()){
                the_book->cur_num+=it.second;
                string JL_back_memo="使用者"+Landed_accout+"於"+this->getCur_time()+"歸還圖書《"+it.first+"》"+to_string(it.second)+"本";
                this->Back_memo.push_back(JL_back_memo);
             }
            }
        }
        this->Users[Landed_accout].u_memo.clear();
        Sleep(500);
        cout<<"一鍵歸還完畢"<<endl;
        this->Save_Back_memo();
        this->Save_Book();
  		system("pause");
		system("cls");
		goto FLAGu;
	}
	else if (ch == '8') {
		this->Users.erase(this->Landed_accout);
		this->Save_Users();
		cout << "賬號已成功登出.系統自動退出" << endl;
		exit(0);
	}
	else if (ch == '9') {
		cout << "請輸入您更改後的密碼" << endl;
		string new_code;
		cin >> new_code;
		this->Users[this->Landed_accout].u_code = new_code;
		this->Save_Users();
		cout << "修改成功!" << endl;
		system("pause");
		system("cls");
		goto FLAGu;
	}
	else if (ch == '0') {
    SetColorAndBackground(4,6);
    cout<<"-----------------------------------------------------"<<endl;
    cout<<"退出系統需啟用一鍵歸還,要持續借書請向管理員線下申請."<<endl;
    cout<<"-----------------------------------------------------"<<endl;
    SetColorAndBackground(0,7);
    cout<<"是否繼續。"<<endl;
    cout<<"【輸0】--取消操作|【非0】--繼續操作"<<endl;
    char jd='0';
    cin>>jd;
    Sleep(500);
    if(jd=='0'){
        cout<<"已取消本次操作."<<endl;
         Sleep(500);
        system("pause");
		system("cls");
		goto FLAGu;
    }
    else{
     cout<<"自動開始一鍵歸還..."<<endl;
        for(auto it: this->Users[Landed_accout].u_memo){
             vector<Book>::iterator the_book =find_if(this->tmbook.begin(),this->tmbook.end(),help_find(it.first));
             if(the_book!=this->tmbook.end()){
                the_book->cur_num+=it.second;
                  string JL_back_memo="使用者"+Landed_accout+"於"+this->getCur_time()+"歸還圖書《"+it.first+"》"+to_string(it.second)+"本";
                this->Back_memo.push_back(JL_back_memo);
             }
        }
        this->Users[Landed_accout].u_memo.clear();
        Sleep(500);
        cout<<"一鍵歸還完畢"<<endl;
        this->Save_Back_memo();
        this->Save_Book();
        this->myover();
        }
	}
	else {
		cout << "選項輸入錯誤,請重新輸入" << endl;
		system("pause");
		system("cls");
		goto FLAGu;
	}
}

3️⃣main.cpp

#include "Labray.h"
using namespace std;
int main() {
	Labray H_labray;
	H_labray.Landing();
	return 0;
}

4️⃣檔案總覽

在這裡插入圖片描述







【5】效果展示

1️⃣:開始介面

在這裡插入圖片描述

2️⃣:註冊介面

在這裡插入圖片描述

3️⃣:管理員功能

在這裡插入圖片描述

4️⃣:使用者功能

在這裡插入圖片描述

5️⃣:遊覽全部圖書

在這裡插入圖片描述

6️⃣:搜尋圖書

在這裡插入圖片描述

7️⃣:借閱與歸還圖書

借閱:>>>

在這裡插入圖片描述

借閱記錄:>>>
在這裡插入圖片描述
歸還》》
在這裡插入圖片描述
記錄》》》
在這裡插入圖片描述
退出:
在這裡插入圖片描述

8️⃣:管理員借閱/歸還記錄檢視

在這裡插入圖片描述
在這裡插入圖片描述

【6】後記補充

  • 1.關於分類號搜尋的使用,用字串擷取,做匹配就能簡單完成。由於樣本給的分類號沒有具體標準,所以我自創了一個,用它來對樣本處理應該是不合適的。
  • 2.我用了很多goto語句,這樣可減少迴圈或者函數呼叫,對我自己看,是很方便的。【快樂自己,麻煩他人👻,大家還是老老實實用迴圈或者函數跳轉】
  • 3.我用了STL,主要是因為,高階演演算法編不出我想多多瞭解一下STL,
  • 4.在學習路上,免不了會遇到各種各樣的誘惑——
    沒錯,我打遊戲去了,發現了一款名叫
    《饑荒》的遊戲,就…
  • 5.欠下的功課是要慢慢補的~%?…,# *'☆&℃$︿★?,要成為{技術大神},還要更加加油
  • 雖然我還會受到各種誘惑勾引

在這裡插入圖片描述