家谱图程序Word格式.docx

上传人:b****6 文档编号:16201895 上传时间:2022-11-21 格式:DOCX 页数:14 大小:17.04KB
下载 相关 举报
家谱图程序Word格式.docx_第1页
第1页 / 共14页
家谱图程序Word格式.docx_第2页
第2页 / 共14页
家谱图程序Word格式.docx_第3页
第3页 / 共14页
家谱图程序Word格式.docx_第4页
第4页 / 共14页
家谱图程序Word格式.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

家谱图程序Word格式.docx

《家谱图程序Word格式.docx》由会员分享,可在线阅读,更多相关《家谱图程序Word格式.docx(14页珍藏版)》请在冰豆网上搜索。

家谱图程序Word格式.docx

voidFindPeople(TreeNodePtree);

voidPrintfFamily(TreeNodePtree);

voidPrintfNode(TreeNodePtree);

voidPrintfAllChildren(TreeNodePtree);

voidAddMember(TreeNodePtree);

voidModification(TreeNodePtree);

voidHelp();

voidInterFace()

intchoice;

printf("

\n----------------菜单--------------------\n"

);

1.创建一个家谱\n"

2.输出家谱中所有人\n"

3.查找某个人的信息\n"

4.查找某人所有孩子\n"

5.在家谱中添加成员\n"

6.在家谱中修改资料\n"

7.与某人断绝关系\n"

8.系统使用帮助\n"

9.退出系统\n"

------------------------------------------\n"

输入你的选择:

"

scanf("

%d"

&

choice);

while(choice<

1||choice>

8)

{

printf("

请输入范围内的数字:

}

switch(choice)

{

case1:

{CreateFamily(treehead);

break;

}

case2:

{PrintfFamily(treehead);

case3:

{FindPeople(treehead);

case4:

{PrintfAllChildren(treehead);

case5:

{AddMember(treehead);

case6:

{Modification(treehead);

case7:

{DelPerson(treehead);

case8:

{Help();

case9:

{exit(0);

}

TreeNodePInite()

TreeNodePp;

char*s="

sdf"

;

p=(TreeNodeP)malloc(sizeof(TreeNode));

正在初始化一个家谱。

\n"

\n请输入家谱顶端祖先的姓名:

scanf("

%s"

p->

name);

strcpy(p->

sex,"

man"

\n请输入顶端祖先配偶姓名:

spousename);

p->

child=NULL;

brother=NULL;

parent=NULL;

system("

cls"

returnp;

voidCreateFamily(TreeNodePtree)

{

charflag;

fflush(stdin);

\n\t给%s添加后代......"

tree->

tree->

child=AddChild(tree->

child,tree);

TreeNodePAddBrother(TreeNodePtree,TreeNodePbrother)

tree=(TreeNodeP)malloc(sizeof(TreeNode));

parent=brother->

parent;

\n请输入%s弟弟或妹妹的姓名:

brother->

\n请输入%s的性别{F/M}:

sex);

\n请输入%s的是否有配偶{Y/N}:

%c"

flag);

if(flag=='

y'

||flag=='

Y'

\n请输入%s的配偶姓名:

fflush(stdin);

\n请输入%s是否添加孩子{Y/N}:

if(flag=='

){

tree->

else

tree->

}

}else{

strcpy(tree->

spousename,"

\n请输入%s是否添加弟弟妹妹{Y/N}:

brother=AddBrother(tree->

brother,tree);

else

returntree;

TreeNodePAddChild(TreeNodePtree,TreeNodePparents)

parent=parents;

\n请输入%s第一个孩子的姓名:

parents->

voidPrintfNode(TreeNodePtree)

if(tree!

=NULL)

\n孩子:

%s性别:

%s"

name,tree->

if(strcmp(tree->

)!

=0)

printf("

配偶:

}else{

未婚"

if(tree->

brother!

PrintfNode(tree->

brother);

\n----------------------------------------"

if(tree->

child!

=NULL)

PrintfFamily(tree);

voidPrintfFamily(TreeNodePtree)

{

\n姓名:

\n配偶:

}else

parent!

\n此人父母:

%s和%s"

parent->

child);

TreeNodePFindNode(TreeNodePtree,char*tt)

TreeNodePp=NULL;

name,tt)==0||strcmp(tree->

spousename,tt)==0)p=tree;

else{

p=FindNode(tree->

child,tt);

if(p!

=NULL)returnp;

else

brother,tt);

}

if(p!

elsereturnNULL;

voidFindPeople(TreeNodePtree)

chartt[20];

TreeNodePT;

\n请输入要查找的人的姓名:

tt);

T=FindNode(tree,tt);

if(T!

T->

\n性别:

if(strcmp(T->

=0){

未婚!

}

查不到此人!

}

voidPrintfAllChildren(TreeNodePtree)

\n请输入:

if((T=T->

child)!

name,T->

if(strcmp(T->

{

printf("

}else{

}

while((T=T->

brother)!

voidAddMember(TreeNodePtree)

chartt[20],choice;

\n请输入在哪儿添加姓名:

\n没有此人!

return;

\n添加成员与此人关系----------------"

\n\t1.父子(女)关系"

\n\t2.兄弟(姐妹)关系"

\n-----------------------------------"

\n请选择:

while(choice<

2)

if(choice==1)

if(T->

T=T->

child;

while(T->

=NULL){

brother;

}

T->

brother=AddBrother(T->

brother,T);

}else

child=AddChild(T->

child,T);

\n此人未婚!

elseif(choice==2){

T->

brother=AddBrother(T->

voidModification(TreeNodePtree)

chartt[20],flag;

\n请输入要修改的人的姓名:

\n修改前-----"

\n修改后-----"

\n性别{F/M}:

\n请输入该人是否有配偶(Y/N):

}elsestrcpy(T->

voidDelPerson(treehead)

voidHelp()

\n本系统使用指南:

\n------------------------------------------------------\n"

\n1、使用本系统前,请仔细阅读本系统使用指南。

\n2、严格遵守本系统使用规则。

\n3、本系统使用规则:

\n根据常识,在家谱中重名的情况很少,"

\n所以我们输入的姓名一般也不要重名。

如"

\n果有重名情况,则可以在姓名中做标记再输入。

\n本系统没有考虑以下几种情况:

\n1.再婚(夫妻一方去世)。

\n2.离异(若有孩子,孩子跟外性配偶)。

\n3.重名(若有重名,可做标记存储)"

\n------------------------------------------------------\n\n"

intmain()

treehead=Inite();

while

(1)

InterFace();

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 艺术

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1