資源簡介
c語言數據結構期末大作業-家族族譜管理
要求設計實現具有下列功能的家譜管理系統:
(1)輸入文件以存放最初家譜中各成員的信息,成員的信息中均應包含以下內容:
姓名、出生日期、婚否、地址、健在否、死亡日期(若其已死亡),也可附加其它信息、但不是必需的。
(2) 實現數據的存盤和讀盤。
(3)以圖形方式顯示家譜。
(4)顯示第n 代所有人的信息。
(5)按照姓名查詢,輸出成員信息(包括其本人、父親、孩子的信息)。
(6)按照出生日期查詢成員名單。
(7)輸入兩人姓名,確定其關系。
(8)某成員添加孩子。
(9)刪除某成員(若其還有后代,則一并刪除)。
(10)修改某成員信息。
(11)按出生日期對家譜中所有人排序。
(12)打開一家譜時,可提示當天生日的健在成員。

代碼片段和文件信息
#include?
#include?
#include?
#include??
#include?“jiapu.h“
#include?
int?Createfamilytree(person?&Fperson?&T)??????????//創建家譜樹函數,即為空家譜添加一個祖先
{
int?ij=1;
person?a;?
????a=(person)malloc(sizeof(CSNode));
xin(a);
printf(“請輸入此人名字:\n“);
scanf(“%s“F->data.name);
????fflush(stdin);
a=Value(TF->data.name);
if(a)
{
printf(“此人已存在該家譜中!\n“);
return?0;
}
printf(“請輸入此人性別(男輸入1,女輸入0):\n“);
while(j)
{
????????scanf(“%d“&(F->data.sex));
fflush(stdin);
switch(F->data.sex)
{
case?1:
j=0;
break;
case?0:
j=0;
break;
default:
printf(“輸入數據有誤請重新輸入!\n“);
fflush(stdin);
break;
}
}
printf(“請輸入此人身高(單位:cm):\n“);
scanf(“%d“&(F->data.height));
fflush(stdin);
printf(“請輸入此人居住地址:\n“);
scanf(“%s“F->data.address);
fflush(stdin);
????printf(“請輸入此人父親的名字(無父親請輸入0):\n你有3次機會\n“);
i=3;
????while(i)
{
scanf(“%s“F->data.parentname);
fflush(stdin);
if(strcmp(F->data.parentname“0“)==0)
break;
else
{
a=Value(TF->data.parentname);
if(a==0||a->data.sex==0)
{
i--;
printf(“父親姓名輸入錯誤\n你還有%d次機會\n“i);
}
else
{
printf(“父親姓名輸入正確。\n“);
F->parent=a;
if(a->firstchild==NULL)
a->firstchild=F;
else
{
a=a->firstchild;
while(a->nextbrother)
a=a->nextbrother;
a->nextbrother=F;
}
break;
}
}
}
if(!i)
{
????????fflush(stdin);
return?0;
}
printf(“請說明此人是否已婚(已婚輸入1,未婚輸入0)\n“);
j=1;
while(j)
{
????????scanf(“%d“&(F->data.jiehun));
fflush(stdin);
switch(F->data.jiehun)
{
case?1:
j=0;
printf(“請輸入此人配偶的名字:\n“);
scanf(“%s“F->data.wife_or_husband);
fflush(stdin);
break;
case?0:
j=0;
????????????strcpy(F->data.wife_or_husband“0“);
break;
default:
printf(“輸入數據有誤請重新輸入!\n“);
fflush(stdin);
break;
}
}
printf(“請輸入此人出生地址:\n“);
scanf(“%s“F->data.birthplace);
fflush(stdin);
printf(“請輸入此人學歷:\n“);
scanf(“%s“F->data.education);
fflush(stdin);
printf(“請輸入此人的職業:\n“);
scanf(“%s“F->data.occupation);
fflush(stdin);
printf(“請輸入此人的簡歷(字數控制在50字以內):\n“);
scanf(“%s“F->data.resume);
fflush(stdin);
????printf(“請說明此人是否還健在(健在輸入1死亡輸入0):\n“);
j=1;
while(j)
{
scanf(“%d“&(F->data.alive));
fflush(stdin);
switch(F->data.alive)
{
case?1:
i=0;
j=0;
while(i==0)
{
i=riqi(F);
}
F->data.deathdate.year=F->data.deathdate.month=F->data.deathdate.day=0;
break;
case?0:
i=0;
j=0;
while(i==0)
{
i=riqi(F);
}
i=0;
while(i==0)
{
i=riqi1(F);
}
break;
default:
printf(“輸入數據有誤請重新輸入!\n“);
fflush(stdin);
break;
}
}
????return?1;
}
int?time(person?&T)??????????????//判斷出生日期是否在今天之前
{
int?Wabc;
int?U=0V=0X=0D=0J=0L=0;
time_t?tval;
struct?tm?*now;
tval?=?time(NULL);
now?=?localtime(&tval);
a=no
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-12-27?17:00??家譜\
?????文件????????7897??2012-02-15?17:03??家譜\1.cpp
?????文件????????3802??2012-02-15?17:03??家譜\2.cpp
?????文件????????1249??2012-02-15?17:03??家譜\3.cpp
?????文件????????2757??2012-02-16?20:52??家譜\4.cpp
?????文件????????9763??2012-02-17?22:02??家譜\5.cpp
?????文件???????12634??2012-02-15?19:53??家譜\6.cpp
?????文件????????8651??2012-02-15?17:03??家譜\7.cpp
?????文件????????2118??2012-02-15?17:03??家譜\8.cpp
?????文件?????????827??2012-02-15?17:03??家譜\alog3_2.cpp
?????目錄???????????0??2012-02-17?22:02??家譜\Debug\
?????文件???????28957??2012-02-16?23:33??家譜\Debug\1.obj
?????文件???????????0??2012-02-16?23:33??家譜\Debug\1.sbr
?????文件???????18428??2012-02-16?23:33??家譜\Debug\2.obj
?????文件???????????0??2012-02-16?23:33??家譜\Debug\2.sbr
?????文件???????13900??2012-02-16?23:33??家譜\Debug\3.obj
?????文件???????????0??2012-02-16?23:33??家譜\Debug\3.sbr
?????文件???????17526??2012-02-16?23:33??家譜\Debug\4.obj
?????文件???????????0??2012-02-16?23:33??家譜\Debug\4.sbr
?????文件???????34237??2012-02-17?22:02??家譜\Debug\5.obj
?????文件???????????0??2012-02-17?22:02??家譜\Debug\5.sbr
?????文件???????31867??2012-02-16?23:33??家譜\Debug\6.obj
?????文件???????????0??2012-02-16?23:33??家譜\Debug\6.sbr
?????文件???????28718??2012-02-16?23:33??家譜\Debug\7.obj
?????文件???????????0??2012-02-16?23:33??家譜\Debug\7.sbr
?????文件???????14755??2012-02-16?23:33??家譜\Debug\8.obj
?????文件???????????0??2012-02-16?23:33??家譜\Debug\8.sbr
?????文件???????12975??2012-02-16?23:33??家譜\Debug\alog3_2.obj
?????文件???????????0??2012-02-16?23:33??家譜\Debug\alog3_2.sbr
?????文件???????21422??2012-02-16?23:33??家譜\Debug\gongneng.obj
?????文件???????????0??2012-02-16?23:33??家譜\Debug\gongneng.sbr
............此處省略20個文件信息
- 上一篇:約瑟夫環問題圖形界面展示
- 下一篇:VC仿Xp計算器
評論
共有 條評論