数据结构家谱管理系统

发布时间 : 星期日 文章数据结构家谱管理系统更新完毕开始阅读

{ if(root!=NULL) numberofpeople++; NumberOfPeople(root->child); NumberOfPeople(root->brother); } return numberofpeople;*/ else return Numberofpeople; } //int count=0; int FamilyTree::LifeNum( ) //健在人数 { if(root==NULL) //-1表示这个家族不存在 return -1; /*else { if(toupper(root->=='Y') count++; LifeNum(root->child); LifeNum(root->brother); } return count;*/ return LifePeopele; } void FamilyTree::PrintMessage(Node *root ) //输出基本信息 { if(root==NULL) return ; else { cout<<\姓名:\ cout<<\性别:\ cout<<\配偶:\ cout<<\出生地:\ cout<<\生日:\ cout<<\父亲:\ cout<<\学历:\ cout<<\工作:\ cout<<\是否健在:\ if(toupper(root->=='Y') cout<<\是\ else cout<<\否\ } } int message=0; //判断是否查找成功 int FamilyTree::Message(Node *root,string Name) //显示该成员的基本信息 { if(root==NULL) return message; else { if(root->==Name) { message=1; PrintMessage(root ); } else { Message(root->child,Name); Message(root->brother,Name); } } return message; } Node* FamilyTree::PreFindFather(Node *root,string FatherName) //给定元素值查找父亲结点指针位置并返回其指针,此方法采用的先序遍历 { if(root==NULL) throw\错误\ Node *p; Node *tree[20]; int top=0; while(root!=NULL||top!=0) { while(root!=NULL) { if(root->==FatherName) p=root; top++;

联系合同范文客服:xxxxx#qq.com(#替换为@)