![家譜管理系統(tǒng)數(shù)據(jù)結(jié)構(gòu)_第1頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-2/24/9ff67640-126a-42d4-a347-f68d8d88e227/9ff67640-126a-42d4-a347-f68d8d88e2271.gif)
![家譜管理系統(tǒng)數(shù)據(jù)結(jié)構(gòu)_第2頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-2/24/9ff67640-126a-42d4-a347-f68d8d88e227/9ff67640-126a-42d4-a347-f68d8d88e2272.gif)
![家譜管理系統(tǒng)數(shù)據(jù)結(jié)構(gòu)_第3頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-2/24/9ff67640-126a-42d4-a347-f68d8d88e227/9ff67640-126a-42d4-a347-f68d8d88e2273.gif)
![家譜管理系統(tǒng)數(shù)據(jù)結(jié)構(gòu)_第4頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-2/24/9ff67640-126a-42d4-a347-f68d8d88e227/9ff67640-126a-42d4-a347-f68d8d88e2274.gif)
![家譜管理系統(tǒng)數(shù)據(jù)結(jié)構(gòu)_第5頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-2/24/9ff67640-126a-42d4-a347-f68d8d88e227/9ff67640-126a-42d4-a347-f68d8d88e2275.gif)
版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、#include<stdio.h>#include<string.h>#include<stdlib.h>#include<conio.h>#defineMAXS100#defineElemtypechartypedefstructBiTNodeintmark;intlevel;charname50;charbirthday50;charaddressMAXS;Elemtypedata;structBiTNode*lc,*rc;BiTNode,*BiTree;charnametemp50;姓名charbirthdaytemp50;/生日chara
2、ddresstempMAXS;/地址charch;intleveltemp;intNth;charsearchdata50;charsearchname50;intcount;BiTreetemp;BiTreeCreateBiTree(FILE*fp);voidPrintInfo(BiTreeT);voidPreOrderTS(BiTreeT);voidShowNth(BiTreeT);voidSearchByName(BiTreeT);voidSearchByBirthday(BiTreeT);voidAddChild(BiTreeT);voidDeleteByName(BiTreeT);v
3、oidsearchmenu();voidmenu();voidinsystem();voidclosefile();#include"my.h"voidSearchByName(BiTreeT)/按照姓名查詢(xún),輸出成員信息if(T->lc->rc)temp=T->lc->rc;while(temp)if(strcmp(temp->name,searchname)=0)count+;printf("n此人的信息為:n");Printlnfo(temp);printf("此人父兄的信息為:n");Printl
4、nfo(T);if(temp->lc->rc)printf("此人孩子的信息為:n");temp=temp->lc->rc;while(temp)Printlnfo(temp);temp=temp->rc;return;elsetemp=temp->rc;SearchByName(T->lc);SearchByName(T->rc);elseprintf("請(qǐng)先建立家庭關(guān)系n");return;voidSearchByBirthday(BiTreeT)/按照出生日期查詢(xún)成員名單if(T)if(strcmp(
5、T->birthday,searchdata)=0)Printlnfo(T);count+;voidAddChild(BiTreeT)/某成員添加孩子if(T)if(strcmp(T->name,searchname)=0)count+;temp=(BiTree)malloc(sizeof(BiTNode);printf("請(qǐng)輸入添加孩子的姓名:n");scanf("%s",temp->name);printf("請(qǐng)輸入添加孩子的出生年月:(格式形如:2010-1-1)n");scanf("%s"
6、,temp->birthday);printf("請(qǐng)輸入添加孩子的家庭住址:n");scanf("%s",temp->address);temp->level=T->level+1;temp->rc=T->lc->rc;temp->lc=NULL;T->lc->rc=temp;printf("孩子添加成功n");return;AddChild(T->lc);AddChild(T->rc);elseprintf("請(qǐng)先建立家庭關(guān)系n");retu
7、rn;voidDeleteByName(BiTreeT)/刪除某成員(若其還有后代,則一并刪除)if(T)if(strcmp(T->name,searchname)=0)count+;T=NULL;return;DeleteByName(T->lc);DeleteByName(T->rc);BiTreeCreateBiTree(FILE*fp)if(!feof(fp)BiTreeT;T=(BiTree)malloc(sizeof(BiTNode);fscanf(fp,"%s%s%sn",nametemp,birthdaytemp,addresstemp);
8、fscanf(fp,"%d",&leveltemp);if(strcmp(nametemp,"n")=0)&&(strcmp(birthdaytemp,"n")=0)&&(strcmp(addresstemp,"n")=0)T=NULL;returnT;elsestrcpy(T->name,nametemp);strcpy(T->birthday,birthdaytemp);strcpy(T->address,addresstemp);T->level
9、=leveltemp+1;printf("讀取成功n");T->lc=CreateBiTree(fp);T->rc=CreateBiTree(fp);returnT;elsereturnNULL;#include"my.h"voidmain()BiTreeT;intchoice;FILE*fp;T=NULL;需操作:");-nn");擇:");T=CreateBiTree(fp);父母的姓名:n");n");count=0;printf("請(qǐng)輸入要?jiǎng)h除成員的姓名:");sc
10、anf("%s",searchname);DeleteByName(T);if(count=0)printf("沒(méi)有這個(gè)人n");fp=fopen("F:family.txt","r");insystem();while(1)system("cls");menu();printf("請(qǐng)根據(jù)菜單進(jìn)行選擇所while(scanf("%d”,&choice)!=1)fflush(stdin);printf("n-輸入錯(cuò)誤printf("請(qǐng)重新輸入正確選f
11、flush(stdin);switch(choice)case 1:system("pause");break;case 2:count=0;printf("請(qǐng)輸入要添加孩子scanf("%s",searchname);AddChild(T);if(count=0)printf("沒(méi)有這個(gè)人system("pause");break;case 3:system("pause");break;case 4:searchmenu();printf("請(qǐng)輸入選擇:n");syste
12、m("pause");break;case 5:PreOrderTS(T);system("pause");break;case 6:closefile();case 7:printf("請(qǐng)輸入需要查詢(xún)第幾代人:");count=0;scanf("%d",&Nth);ShowNth(T);if(count=0)printf("第d代尚未有人。n",Nth);system("pause");break;case 8:printf("請(qǐng)輸入要查詢(xún)?nèi)说男彰?qu
13、ot;);scanf("%s",searchname);if(strcmp(T->name,searchname)=0)printf("此人為家譜的祖先,其信息為:n");printf("%-10s%-10s%-10sn",T->name,T->birthday,T->address);printf("他兄弟的信息為:n");printf("%-10s%-10s%-10s%n”,T->lc->name,T->lc->birthday,T->lc->
14、;address);temp=T->lc;if(temp->rc)printf("他孩子的信息為:n");temp=temp->rc;while(temp)printf("%-10s%-10s%-10sn",temp->name,temp->birthday,temp->address);temp=temp->rc;elsecount=0;SearchByName(T);if(count=0)printf("對(duì)不起,不能檢測(cè)這個(gè)人的信息n");system("pause")
15、;break;case 9:printf("請(qǐng)輸入要查詢(xún)?nèi)说纳?");count=0;scanf("%s",searchdata);SearchByBirthday(T);if(count=0)printf("%s沒(méi)有人過(guò)生日。n",searchdata);system("pause");break;default:printf("n-輸入錯(cuò)誤一n");break;printf("nn");printf("按任意鍵繼續(xù)!");getch();#inclu
16、de"my.h"voidinsystem()intflag1,flag2;charname20="student"charpassword10="111111”;charperson20;chara10;printf("tt*歡迎進(jìn)入家譜管理系統(tǒng)!*nn");printf("ttt用戶(hù)登錄nn");printf("tttt用戶(hù)名:");gets(person);flag1=strcmp(person,name);printf("tttt密碼:");gets(a);f
17、lag2=strcmp(password,a);功!nn");密碼錯(cuò)誤! nn");您無(wú)權(quán)使用!nn");if(flag1=0&&flag2=0)printf("tttt登錄成elseprintf("ttt用戶(hù)名或printf("tttexit(0);#include"my.hvoidmenu()printf("*nn");*歡迎使用家譜管理系統(tǒng)*printf("tt1建立家族關(guān)系(并保存)n");printf("tt2添加家族成員n");print
18、f("tt3刪除家族成員n");printf("tt4查詢(xún)家族成員n");printf("tt5顯示家族關(guān)系n");printf("tt6>退出系統(tǒng)n");*n");printf("tt*voidsearchmenu()printf("tt7>按姓名查詢(xún)n");printf("tt8按出生日期查詢(xún)n");voidPrintInfo(BiTreeT)printf("%10s%10s%10sn",T->name,T->b
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 學(xué)校營(yíng)養(yǎng)餐供應(yīng)合同
- 技術(shù)轉(zhuǎn)移合同
- 棉被購(gòu)銷(xiāo)合同正規(guī)范本年
- 橋梁模板運(yùn)輸合同
- 第三章遺傳算法
- 控制系統(tǒng)剩余壽命預(yù)測(cè)與自主維護(hù)研究綜述
- 并聯(lián)式液壓制動(dòng)能量回收系統(tǒng)研究
- 2025年南京貨運(yùn)資格證答題竅門(mén)
- W波段光電融合毫米波寬帶跳頻通信技術(shù)研究
- 2025年新科版九年級(jí)歷史下冊(cè)階段測(cè)試試卷含答案
- 人教八年級(jí)上冊(cè)英語(yǔ)第一單元《Section A (1a-2d)》教學(xué)課件
- 2023年版《安寧療護(hù)實(shí)踐指南(試行)》解讀課件
- 中國(guó)血管通路專(zhuān)家共識(shí)解讀
- 開(kāi)學(xué)前幼兒園安全培訓(xùn)
- 《裝配式蒸壓加氣混凝土外墻板保溫系統(tǒng)構(gòu)造》中
- 中國(guó)紅十字會(huì)救護(hù)員培訓(xùn)理論考試試題及答案
- 《建設(shè)工程監(jiān)理》課件
- 2019版新人教版高中英語(yǔ)必修+選擇性必修共7冊(cè)詞匯表匯總(帶音標(biāo))
- 中層領(lǐng)導(dǎo)的高績(jī)效管理
- 小小銀行家-兒童銀行知識(shí)、理財(cái)知識(shí)培訓(xùn)
- 閱讀理解特訓(xùn)卷-英語(yǔ)四年級(jí)上冊(cè)譯林版三起含答案
評(píng)論
0/150
提交評(píng)論