 '\0') select = file_book.Find<NodeBook>(std::string(select.isbn));
}

void BaseAccount::Register(std::string id, std::string password, std::string user_name) {
    People BaseAccount(id, user_name, password, 1);
    try {
        file_BaseAccount.Insert(BaseAccount);
    } catch (Invalid) { throw Invalid(); }
}

void BaseAccount::Passwd(std::string id, std::string old_passwd, std::string new_passwd) {
    try {
        People BaseAccount = file_BaseAccount.Find<People>(id);
        if (BaseAccount.password == old_passwd) {
            strcpy(BaseAccount.password, <PASSWORD>_<PASSWORD>.c_str());
            file_BaseAccount.Delete(id);
            file_BaseAccount.Insert(BaseAccount);
        } else throw Invalid();
    } catch (Invalid) { throw Invalid(); }
}

void BaseAccount::Passwd(std::string id, std::string new_passwd) {
    try {
        People BaseAccount = file_BaseAccount.Find<People>(id);
        strcpy(BaseAccount.password, <PASSWORD>_passwd.c_str());
        file_BaseAccount.Delete(id);
        file_BaseAccount.Insert(BaseAccount);
    } catch (Invalid) { throw Invalid(); }
}

void BaseAccount::Useradd(std::string id, std::string password, int priority, std::string user_name) {
    People now_BaseAccount = stk[stk.size() - 1];
    if (priority >= now_BaseAccount.priority) throw Invalid();
    People BaseAccount(id, user_name, password, priority);
    try {
        file_BaseAccount.Insert(BaseAccount);
    } catch (Invalid) { throw Invalid(); }
}

void BaseAccount::Delete(std::string id) {
    for (int i = 0; i < stk.size(); i++)
        if (stk[i].user_id == id)
            throw Invalid();
    try {
        file_BaseAccount.Delete(id);
    } catch (Invalid) { throw Invalid(); }
}

void BaseAccount::Show(ShowMessage infor) {
    try {
        if (infor.isbn[0]!= '\0') {
            NodeBook book = file_book.Find<NodeBook>(std::string(infor.isbn));
            if (infor.book_name[0]!= '\0') {
                if (std::string(book.book_name)!= std::string(infor.book_name))
                    throw Invalid();
            }
            if (infor.author[0]!= '\0') {
                if (std::string(book.author)!= std::string(infor.author))
                    throw Invalid();
            }
            if (infor.keyword[0]!= '\0') {
                std::string keyword = std::string(book.keyword);
                keyword += "|";
                while (keyword!= "") {
                    std::string keyword_ = GetKey(keyword);
                    if (keyword_ == std::string(infor.keyword)) {
                        std::cout << book;
                        return;
                    }
                }
                throw Invalid();
            }
            std::cout << book;
        } else if (infor.book_name[0]!= '\0') {
            std::string ans = file_name.FindMore(std::string(infor.book_name));
            bool ok = 0;
            std::fstream file;
            file.open("file_name");
            while (ans!= "") {
                Block_ <NodeBookName> block;
                long long locate = CheckNum_(Get(ans));
                file.seekg(locate);
                file.read(reinterpret_cast<char *>(&block), sizeof(Block_ < NodeBookName > ));
                for (int i = 1; i <= block.now; i++) {
                    if (std::string(block.size[i].book_name)!= std::string(infor.book_name))
                        continue;
                    if (infor.author[0]!= '\0')
                        if (std::string(block.size[i].author)!= std::string(infor.author))
                            continue;
                    if (infor.keyword[0]!= '\0') {
                        std::string keyword = std::string(block.size[i].keyword);
                        keyword += "|";
                        while (keyword!= "") {
                            std::string keyword_ = GetKey(keyword);
                            if (keyword_ == std::string(infor.keyword)) {
                                std::cout << block.size[i];
                                ok = 1;
                            }
                        }
                    } else {
                        std::cout << block.size[i];
                        ok = 1;
                    }
                }
            }
            file.close();
            if (!ok) throw Invalid();
        } else if (infor.author[0]!= '\0') {
            std::string ans = file_author.FindMore(std::string(infor.author));
            bool ok = 0;
            std::fstream file;
            file.open("file_author");
            while (ans!= "") {
                Block_ <NodeBookAuthor> block;
                long long locate = CheckNum_(Get(ans));
                file.seekg(locate, std::ios::beg);
                file.read(reinterpret_cast<char *>(&block), sizeof(Block_ < NodeBookAuthor > ));
                for (int i = 1; i <= block.now; i++) {
                    if (std::string(block.size[i].author)!= std::string(infor.author))
                        continue;
                    if (infor.keyword[0]!= '\0') {
                        std::string keyword = std::string(block.size[i].keyword);
                        keyword += "|";
                        while (keyword!= "") {
                            std::string keyword_ = GetKey(keyword);
                            if (keyword_ == std::string(infor.keyword)) {
                                std::cout << block.size[i];
                                ok = 1;
                            }
                        }
                    } else {
                        std::cout << block.size[i];
                        ok = 1;
                    }
                }
            }
            file.close();
            if (!ok) throw Invalid();
        } else if (infor.keyword[0]!= '\0') {
            std::string ans = file_keyword.FindMore(std::string(infor.keyword));
            bool ok = 0;
            std::fstream file;
            file.open("file_keyword");
            while (ans!= "") {
                Block_ <NodeBookKeyword> block;
                long long locate = CheckNum_(Get(ans));
                file.seekg(locate);
                file.read(reinterpret_cast<char *>(&block), sizeof(Block_ < NodeBookKeyword > ));
                for (int i = 1; i <= block.now; i++) {
                    if (std::string(block.size[i].keyword_) == std::string(infor.keyword)) {
                        std::cout << block.size[i];
                        ok = 1;
                    }
                }
            }
            file.close();
            if (!ok) throw Invalid();
        } else {
            std::fstream file, file_index;
            file.open("file_book");
            file_index.open("file_book_index");
            NodeIndex_ <NodeBook> idx;
            Block_ <NodeBook> block;
            file_index.read(reinterpret_cast<char *>(&idx), sizeof(NodeIndex_ < NodeBook > ));
            if (idx.next == -1) {
                file.close();
                file_index.close();
                throw Invalid();
            }
            file_index.seekg(idx.next, std::ios::beg);
            file_index.read(reinterpret_cast<char *>(&idx), sizeof(NodeIndex_ < NodeBook > ));
            while (1) {
                file.seekg(idx.block_begin);
                file.read(reinterpret_cast<char *>(&block), sizeof(Block_ < NodeBook > ));
                for (int i = 1; i <= block.now; i++)
                    std::cout << block.size[i];
                if (idx.next == -1) {
                    file.close();
                    file_index.close();
                    return;
                }