数据结构大作业之家谱管理系统 联系客服

发布时间 : 星期一 文章数据结构大作业之家谱管理系统更新完毕开始阅读4850fd3bf46527d3250ce00e

ostream &operator<<(ostream &out, const Member

&m){ out << endl << setw(25) << \该成员信息如下:\ << endl <>(istream &in, Member &m){ in >> m.name >> m.birthPlace >> m.birthDay >> m.sex >> m.height >> m.age >> m.education >> m.job >> m.father; return in; } //FamilySystem的成员函数 int FamilySystem::menu(){ cout << \; cout << \---------------------------\\n\; cout << \|\\n\; cout << \系统菜单 |\\n\; cout << \|\\n\; cout << \查询成员 |\\n\; cout << \|\\n\; cout << \查询家庭整体情况 |\\n\; cout << \|\\n\; cout << \添加成员 |\\n\; cout << \|\\n\; cout << \删除

成员 |\\n\; cout << \|\\n\; cout << \修改成员信息 |\\n\; cout << \|\\n\; cout << \显示整个家谱 |\\n\; cout << \|\\n\; cout << \按ESC退出系统 |\\n\; cout << \|\\n\; cout << \---------------------------\\n\; cout << \; int n = 0; while (1){ n = _getch(); if (n == 27) break; if (n >= 49 &&n<=54) break; cout << \请按下1、2、3、4、5、6选择或按ESC键退出!\ << endl; } return n; } bool FamilySystem::fileInit(){ ifstream infile; //打开存储成员信息的文件,读入成员信息 infile.open(\, ios::in | ios::_Nocreate); if (!infile){ return false; } vector genely;//保存这一代成员的指针 vector next;//保存下一代成员的指针 Member *temp = new Member;//临时保存输入的成员信息 root = temp;//第一个赋给root genely.push_back(root); next.push_back(root); while (infile >> *temp){ //将成员放入家族树中,成员的父亲必须是这一代的成员 for (auto i = genely.begin(); i != genely.end(); ++i){ if ((*i)->name == temp->father){ if ((*i)->pson==nullptr) (*i)->pson = temp; else{