} else { if (seek(temp->name) != nullptr){ cout << \此人已存在于家谱中!\ << endl; } else{ cout << \按ENTER确定添加并返回菜单\\n 按ESC取消添加并返回菜单\; for (;;){ int j = _getch(); if (j == 27){ delete temp; break; } if (j == 13){ if (jubge->pson == nullptr) jubge->pson = temp; else{ Member *p = jubge->pson; while (p->pbro != nullptr) p = p->pbro; p->pbro = temp; } cout << \保存成功!\\n\; break; } } } } cout << \按ESC键返回菜单\; for (;;){ if (_getch() == 27) break; } return true; } bool FamilySystem::deleteMem(){ cout << \删除成员.\\n\\n\; cout << \请输入姓名:\; string na; try{ istringstream sin(gets()); sin >> na; } catch (int){ goto end; } Member *temp = seek(na); if (temp == nullptr) cout << \家谱中没有此人!\\n\\n\; else{ if (temp->pson != nullptr){ cout << \此人有后代!若删除此人其后代将同时被删!\; cout << \按ENTER继续\\n 按ESC退出\; for (;;){ int j = _getch(); if ( j== 27) return false; if (j == 13) break; } } Member *p = seek(temp->father); if (p == nullptr) root = nullptr; else if (temp == p->pson) p->pson = nullptr; else{ while (p->pbro!=temp){ p = p->pbro; } p->pbro = nullptr; } cout << \删除成功!\\n\\n\; } cout<<\按ESC键返回菜单\; for (;;){ if (_getch() == 27) break; } end:return true; } bool FamilySystem::demandMem(){ cout << \查询成员.\\n\\n\; cout << \请输入姓名:\; string na; try{ istringstream sin(gets()); sin >> na; } catch (int){ goto end; } Member *m=seek(na); if(m!=nullptr) cout << *m; else cout << \对不起,家谱中没有此人的信息!\\n\\n\; cout << \按ESC键返回菜单\; for (;;){ if (_getch() == 27) break; } end:return true; }